mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-03 06:01:39 +01:00
Remove extra events from alias execution.
When executing an alias we already call an event for the alias itself. The extra events are not needed for logging purposes as the alias itself is logged and the events cause issues for plugins trying to do spam checking on their own. By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
parent
cd6bf023f6
commit
0d884197d5
@ -23,24 +23,6 @@ public class FormattedCommandAlias extends Command {
|
||||
ArrayList<String> commands = new ArrayList<String>();
|
||||
for (String formatString : formatStrings) {
|
||||
try {
|
||||
if (sender instanceof Player) {
|
||||
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent((Player) sender, "/" + formatString);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
} else {
|
||||
formatString = event.getMessage().substring(1);
|
||||
}
|
||||
} else if (sender instanceof RemoteConsoleCommandSender) {
|
||||
RemoteServerCommandEvent event = new RemoteServerCommandEvent(sender, formatString);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
formatString = event.getCommand();
|
||||
} else if (sender instanceof ConsoleCommandSender) {
|
||||
ServerCommandEvent event = new ServerCommandEvent(sender, formatString);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
formatString = event.getCommand();
|
||||
}
|
||||
|
||||
commands.add(buildCommand(formatString, args));
|
||||
} catch (Throwable throwable) {
|
||||
if (throwable instanceof IllegalArgumentException) {
|
||||
|
Loading…
Reference in New Issue
Block a user