org.bukkit.event.server
Class ServerCommandEvent

java.lang.Object
  extended by org.bukkit.event.Event
      extended by org.bukkit.event.server.ServerEvent
          extended by org.bukkit.event.server.ServerCommandEvent
Direct Known Subclasses:
RemoteServerCommandEvent

public class ServerCommandEvent
extends ServerEvent

This event is called when a command is run from the server console. 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:

Examples of incorrect uses are:

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 Summary
 
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
 
Constructor Summary
ServerCommandEvent(CommandSender sender, String command)
           
 
Method Summary
 String getCommand()
          Gets the command that the user is attempting to execute from the console
static HandlerList getHandlerList()
           
 HandlerList getHandlers()
           
 CommandSender getSender()
          Get the command sender.
 void setCommand(String message)
          Sets the command that the server will execute
 
Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerCommandEvent

public ServerCommandEvent(CommandSender sender,
                          String command)
Method Detail

getCommand

public String getCommand()
Gets the command that the user is attempting to execute from the console

Returns:
Command the user is attempting to execute

setCommand

public void setCommand(String message)
Sets the command that the server will execute

Parameters:
message - New message that the server will execute

getSender

public CommandSender getSender()
Get the command sender.

Returns:
The sender

getHandlers

public HandlerList getHandlers()
Specified by:
getHandlers in class Event

getHandlerList

public static HandlerList getHandlerList()


Copyright © 2014. All rights reserved.