From 96445e1e098b222ee3d86e7d7cb3125f93023fdf Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 29 Apr 2015 12:14:29 -0400 Subject: [PATCH] Server Commands and Remote Commands are now Cancellable. By: Matt --- .../bukkit/event/server/ServerCommandEvent.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/event/server/ServerCommandEvent.java b/paper-api/src/main/java/org/bukkit/event/server/ServerCommandEvent.java index 8a5972ae5f..10ea0f00d9 100644 --- a/paper-api/src/main/java/org/bukkit/event/server/ServerCommandEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/server/ServerCommandEvent.java @@ -1,6 +1,7 @@ package org.bukkit.event.server; import org.bukkit.command.CommandSender; +import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; /** @@ -37,10 +38,11 @@ import org.bukkit.event.HandlerList; * beginning of the message should be preserved. If a slash is added or * removed, unexpected behavior may result. */ -public class ServerCommandEvent extends ServerEvent { +public class ServerCommandEvent extends ServerEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); private String command; private final CommandSender sender; + private boolean cancel = false; public ServerCommandEvent(final CommandSender sender, final String command) { this.command = command; @@ -83,4 +85,14 @@ public class ServerCommandEvent extends ServerEvent { public static HandlerList getHandlerList() { return handlers; } + + @Override + public boolean isCancelled() { + return cancel; + } + + @Override + public void setCancelled(boolean cancel) { + this.cancel = cancel; + } }