Make TeleportEvent cancellable

This commit is contained in:
William278 committed 2023-03-24 12:34:18 +00:00
1 parent e8e9b1ffb9
commit 8d8420541d
2 files changed
+13 -2

No files matched your search

@@ -10,13 +10,15 @@ public class TeleportEvent extends Event implements ITeleportEvent {
private static final HandlerList HANDLER_LIST = new HandlerList(); private static final HandlerList HANDLER_LIST = new HandlerList();
private final Teleport teleport; private final Teleport teleport;
private boolean cancelled;
public TeleportEvent(@NotNull Teleport teleport) { public TeleportEvent(@NotNull Teleport teleport) {
this.teleport = teleport; this.teleport = teleport;
} }
@Override @Override
public @NotNull Teleport getTeleport() { @NotNull
public Teleport getTeleport() {
return teleport; return teleport;
} }
@@ -31,4 +33,13 @@ public class TeleportEvent extends Event implements ITeleportEvent {
return HANDLER_LIST; return HANDLER_LIST;
} }
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
@Override
public boolean isCancelled() {
return cancelled;
}
} }
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull;
/** /**
* Representation of an event that fires when a teleport is about to occur * Representation of an event that fires when a teleport is about to occur
*/ */
public interface ITeleportEvent extends Event { public interface ITeleportEvent extends Cancellable {
/** /**
* Get the teleport being carried out * Get the teleport being carried out