Class PlayerCommandEvent
java.lang.Object
me.internalizable.numdrassl.api.event.player.PlayerCommandEvent
- All Implemented Interfaces:
Cancellable
Event fired when a player executes a command (chat message starting with /).
This is fired BEFORE the command is processed.
This event is cancellable. If cancelled, the command will not be executed.
If the command is handled by a plugin, set cancelled to true to prevent the command from being sent to the backend server.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionString[]getArgs()Get the command arguments.Get the command name (without leading slash).Get the full command line (with leading slash).Get the player who executed the command.booleanCheck if this event has been cancelled.voidsetCancelled(boolean cancelled) Set whether this event is cancelled.voidsetForwardToServer(boolean forward) Set whether this command should be forwarded to the backend server.booleanCheck if this command should be forwarded to the backend server.
-
Constructor Details
-
PlayerCommandEvent
-
-
Method Details
-
getPlayer
-
getCommand
Get the command name (without leading slash).- Returns:
- the command name
-
getArgs
-
getCommandLine
Get the full command line (with leading slash).- Returns:
- the full command line
-
shouldForwardToServer
public boolean shouldForwardToServer()Check if this command should be forwarded to the backend server. Set to false if the proxy handles this command.- Returns:
- true if should forward to server
-
setForwardToServer
public void setForwardToServer(boolean forward) Set whether this command should be forwarded to the backend server.- Parameters:
forward- true to forward, false to handle at proxy level
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableCheck if this event has been cancelled.- Specified by:
isCancelledin interfaceCancellable- Returns:
- true if the event is cancelled
-
setCancelled
public void setCancelled(boolean cancelled) Description copied from interface:CancellableSet whether this event is cancelled.- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancelled- true to cancel the event
-