Use Kyori/events for plugin events (#79)

* Initial event proposal

* Event proposal 2

* Use proper syntax for instances

* Add helper method to CarbonEvents
This commit is contained in:
Josh (Vicarious) authored and GitHub committed 2020-09-12 22:55:11 -07:00
1 parent 6721adf57e
commit 28994664f2
34 files changed
+542 -662

No files matched your search

@@ -0,0 +1,69 @@
package net.draycia.carbon.events.api;
import net.draycia.carbon.events.CarbonEvent;
import net.draycia.carbon.storage.ChatUser;
import net.kyori.adventure.text.Component;
import net.kyori.event.Cancellable;
import org.checkerframework.checker.nullness.qual.NonNull;
public class PrivateMessageEvent implements CarbonEvent, Cancellable {
@NonNull
private final ChatUser sender;
@NonNull
private final ChatUser target;
@NonNull
private final Component senderComponent;
@NonNull
private final Component targetComponent;
@NonNull
private final String message;
private boolean cancelled = false;
public PrivateMessageEvent(@NonNull final ChatUser sender, @NonNull final ChatUser target,
@NonNull final Component senderComponent, @NonNull final Component targetComponent,
@NonNull final String message) {
this.sender = sender;
this.target = target;
this.senderComponent = senderComponent;
this.targetComponent = targetComponent;
this.message = message;
}
@Override
public boolean cancelled() {
return this.cancelled;
}
@Override
public void cancelled(final boolean cancelled) {
this.cancelled = cancelled;
}
@NonNull
public ChatUser sender() {
return this.sender;
}
@NonNull
public ChatUser target() {
return this.target;
}
@NonNull
public Component senderComponent() {
return this.senderComponent;
}
@NonNull
public Component targetComponent() {
return this.targetComponent;
}
@NonNull
public String message() {
return this.message;
}
}