Class ServerCommandEvent

  extended by org.bukkit.event.Event
      extended by org.bukkit.event.server.ServerEvent
          extended by org.bukkit.event.server.ServerCommandEvent
Direct Known Subclasses:

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
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


public ServerCommandEvent(CommandSender sender,
                          String command)
Method Detail


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

Command the user is attempting to execute


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

message - New message that the server will execute


public CommandSender getSender()
Get the command sender.

The sender


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


public static HandlerList getHandlerList()

Copyright © 2014. All rights reserved.