Package org.bukkit.event.server
Class ServerCommandEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.server.ServerEvent
org.bukkit.event.server.ServerCommandEvent
- All Implemented Interfaces:
- Cancellable
- Direct Known Subclasses:
- RemoteServerCommandEvent
This event is called when a command is run by a non-player. It is
 called early in the command handling process, and modifications in this
 event (via 
setCommand(String)) will be shown in the behavior.
 Many plugins will have no use for this event, and you should attempt to avoid using it if it is not necessary.
Some examples of valid uses for this event are:
- Logging executed commands to a separate file
- Variable substitution. For example, replacing ${ip:Steve}with the connection IP of the player named Steve, or simulating the@aand@pdecorators used by Command Blocks for plugins that do not handle it.
- Conditionally blocking commands belonging to other plugins.
- Per-sender command aliases. For example, after the console runs the
     command /calias cr gamemode creative, the next time they run/cr, it gets replaced into/gamemode creative. (Global command aliases should be done by registering the alias.)
Examples of incorrect uses are:
- Using this event to run command logic
If the event is cancelled, processing of the command will halt.
 The state of whether or not there is a slash (/) at the
 beginning of the message should be preserved. If a slash is added or
 removed, unexpected behavior may result.
- 
Nested Class SummaryNested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionGets the command that the user is attempting to execute from the consolestatic HandlerListGet the command sender.booleanGets the cancellation state of this event.voidsetCancelled(boolean cancel) Sets the cancellation state of this event.voidsetCommand(String message) Sets the command that the server will executeMethods inherited from class org.bukkit.event.EventgetEventName, isAsynchronous
- 
Constructor Details- 
ServerCommandEvent
 
- 
- 
Method Details- 
getCommandGets the command that the user is attempting to execute from the console- Returns:
- Command the user is attempting to execute
 
- 
setCommandSets the command that the server will execute- Parameters:
- message- New message that the server will execute
 
- 
getSenderGet the command sender.- Returns:
- The sender
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
- 
isCancelledpublic boolean isCancelled()Description copied from interface:CancellableGets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
- isCancelledin interface- Cancellable
- Returns:
- true if this event is cancelled
 
- 
setCancelledpublic void setCancelled(boolean cancel) Description copied from interface:CancellableSets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.- Specified by:
- setCancelledin interface- Cancellable
- Parameters:
- cancel- true if you wish to cancel this event
 
 
-