13
0
geforkt von Mirrors/Paper

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>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2014-02-10 16:18:36 -06:00
Ursprung cd6bf023f6
Commit 0d884197d5

Datei anzeigen

@ -23,24 +23,6 @@ public class FormattedCommandAlias extends Command {
ArrayList<String> commands = new ArrayList<String>(); ArrayList<String> commands = new ArrayList<String>();
for (String formatString : formatStrings) { for (String formatString : formatStrings) {
try { 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)); commands.add(buildCommand(formatString, args));
} catch (Throwable throwable) { } catch (Throwable throwable) {
if (throwable instanceof IllegalArgumentException) { if (throwable instanceof IllegalArgumentException) {