Class PlayerCommandPreprocessEvent
- All Implemented Interfaces:
- Cancellable
setMessage(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
     ${nearbyPlayer}with the name of the nearest other player, or simulating the@aand@pdecorators used by Command Blocks in plugins that do not handle it.
- Conditionally blocking commands belonging to other plugins. For
     example, blocking the use of the /homecommand in a combat arena.
- Per-sender command aliases. For example, after a player 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
- 
Field SummaryFields inherited from class org.bukkit.event.player.PlayerEventplayer
- 
Constructor SummaryConstructorsConstructorDescriptionPlayerCommandPreprocessEvent(Player player, String message) PlayerCommandPreprocessEvent(Player player, String message, Set<Player> recipients) 
- 
Method SummaryModifier and TypeMethodDescriptionstatic HandlerListGets the command that the player is attempting to send.Deprecated.This method is provided for backward compatibility with no guarantee to the effect of viewing or modifying the set.booleanGets the cancellation state of this event.voidsetCancelled(boolean cancel) Sets the cancellation state of this event.voidsetMessage(String command) Sets the command that the player will send.voidSets the player that this command will be executed as.Methods inherited from class org.bukkit.event.player.PlayerEventgetPlayerMethods inherited from class org.bukkit.event.EventgetEventName, isAsynchronous
- 
Constructor Details- 
PlayerCommandPreprocessEvent
- 
PlayerCommandPreprocessEvent
 
- 
- 
Method Details- 
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
 
- 
getMessageGets the command that the player is attempting to send.All commands begin with a special character; implementations do not consider the first character when executing the content. - Returns:
- Message the player is attempting to send
 
- 
setMessageSets the command that the player will send.All commands begin with a special character; implementations do not consider the first character when executing the content. - Parameters:
- command- New message that the player will send
- Throws:
- IllegalArgumentException- if command is null or empty
 
- 
setPlayerSets the player that this command will be executed as.- Parameters:
- player- New player which this event will execute as
- Throws:
- IllegalArgumentException- if the player provided is null
 
- 
getRecipientsDeprecated.This method is provided for backward compatibility with no guarantee to the effect of viewing or modifying the set.Gets a set of recipients that this chat message will be displayed to.The set returned is not guaranteed to be mutable and may auto-populate on access. Any listener accessing the returned set should be aware that it may reduce performance for a lazy set implementation. Listeners should be aware that modifying the list may throw UnsupportedOperationExceptionif the event caller provides an unmodifiable set.- Returns:
- All Players who will see this chat message
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
 
-