Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.event.server.ServerCommandEvent Class Reference
Inheritance diagram for org.bukkit.event.server.ServerCommandEvent:
org.bukkit.event.server.ServerEvent org.bukkit.event.Event org.bukkit.event.server.RemoteServerCommandEvent

Public Member Functions

 ServerCommandEvent (final CommandSender sender, final String command)
 
String getCommand ()
 
void setCommand (String message)
 
CommandSender getSender ()
 
HandlerList getHandlers ()
 
- Public Member Functions inherited from org.bukkit.event.Event
 Event ()
 
 Event (boolean isAsync)
 
String getEventName ()
 
abstract HandlerList getHandlers ()
 
final boolean isAsynchronous ()
 

Static Public Member Functions

static HandlerList getHandlerList ()
 

Detailed Description

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:

  • 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 and decorators 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.

Definition at line 40 of file ServerCommandEvent.java.

Member Function Documentation

String org.bukkit.event.server.ServerCommandEvent.getCommand ( )

Gets the command that the user is attempting to execute from the console

Returns
Command the user is attempting to execute

Definition at line 56 of file ServerCommandEvent.java.

56  {
57  return command;
58  }
CommandSender org.bukkit.event.server.ServerCommandEvent.getSender ( )

Get the command sender.

Returns
The sender

Definition at line 74 of file ServerCommandEvent.java.

74  {
75  return sender;
76  }
void org.bukkit.event.server.ServerCommandEvent.setCommand ( String  message)

Sets the command that the server will execute

Parameters
messageNew message that the server will execute

Definition at line 65 of file ServerCommandEvent.java.

65  {
66  this.command = message;
67  }

The documentation for this class was generated from the following file: