Server Commands and Remote Commands are now Cancellable.

By: Matt <mattbdev@outlook.com>
This commit is contained in:
Bukkit/Spigot 2015-04-29 12:14:29 -04:00
parent 5da3d70916
commit 96445e1e09

View file

@ -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;
}
}