mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 03:52:45 +01:00
Server Commands and Remote Commands are now Cancellable.
By: Matt <mattbdev@outlook.com>
This commit is contained in:
parent
5da3d70916
commit
96445e1e09
1 changed files with 13 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
package org.bukkit.event.server;
|
package org.bukkit.event.server;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
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
|
* beginning of the message should be preserved. If a slash is added or
|
||||||
* removed, unexpected behavior may result.
|
* 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 static final HandlerList handlers = new HandlerList();
|
||||||
private String command;
|
private String command;
|
||||||
private final CommandSender sender;
|
private final CommandSender sender;
|
||||||
|
private boolean cancel = false;
|
||||||
|
|
||||||
public ServerCommandEvent(final CommandSender sender, final String command) {
|
public ServerCommandEvent(final CommandSender sender, final String command) {
|
||||||
this.command = command;
|
this.command = command;
|
||||||
|
@ -83,4 +85,14 @@ public class ServerCommandEvent extends ServerEvent {
|
||||||
public static HandlerList getHandlerList() {
|
public static HandlerList getHandlerList() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue