mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
Lowered the priority of the old command handler event because a number of plugins were using this event incorrectly. A new event, the command preprocesser event, has replaced the previous function of the original command event.
By: sk89q <the.sk89q@gmail.com>
This commit is contained in:
parent
d3a7253d68
commit
e3b86cda50
3 changed files with 22 additions and 3 deletions
|
@ -178,6 +178,13 @@ public abstract class Event {
|
|||
*/
|
||||
PLAYER_COMMAND (Category.PLAYER),
|
||||
|
||||
/**
|
||||
* Called when a player early in the command handling process
|
||||
*
|
||||
* @see org.bukkit.event.player.PlayerChatEvent
|
||||
*/
|
||||
PLAYER_COMMAND_PREPROCESS (Category.PLAYER),
|
||||
|
||||
/**
|
||||
* Called when a player leaves a server
|
||||
*
|
||||
|
|
|
@ -43,9 +43,7 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
|
||||
/**
|
||||
* Called when a player attempts to use a command. Avoid using this
|
||||
* when possible -- it won't be removed, but this is not how you
|
||||
* handle commands.
|
||||
* Called when a player attempts to use a command.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
|
@ -53,6 +51,15 @@ public class PlayerListener implements Listener {
|
|||
public void onPlayerCommand(PlayerChatEvent event) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called early in the command handling process. This event is only
|
||||
* for very exceptional cases and you should not normally use it.
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onPlayerCommandPreprocess(PlayerChatEvent event) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player attempts to move location in a world
|
||||
*
|
||||
|
|
|
@ -150,6 +150,11 @@ public final class JavaPluginLoader implements PluginLoader {
|
|||
((PlayerListener)listener).onPlayerCommand( (PlayerChatEvent)event );
|
||||
}
|
||||
};
|
||||
case PLAYER_COMMAND_PREPROCESS:
|
||||
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
||||
((PlayerListener)listener).onPlayerCommandPreprocess( (PlayerChatEvent)event );
|
||||
}
|
||||
};
|
||||
case PLAYER_CHAT:
|
||||
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
||||
((PlayerListener)listener).onPlayerChat( (PlayerChatEvent)event );
|
||||
|
|
Loading…
Reference in a new issue