SPIGOT-1111: Fix ServerCommandEvent not being cancelled.

This commit is contained in:
md_5 2015-08-08 18:42:24 +10:00
parent 880a53248e
commit 53fac9f1b6

View File

@ -162,7 +162,7 @@
super.B(); super.B();
this.aO(); this.aO();
} }
@@ -296,7 +362,14 @@ @@ -296,7 +362,15 @@
while (!this.l.isEmpty()) { while (!this.l.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.l.remove(0); ServerCommand servercommand = (ServerCommand) this.l.remove(0);
@ -170,6 +170,7 @@
+ // CraftBukkit start - ServerCommand for preprocessing + // CraftBukkit start - ServerCommand for preprocessing
+ ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command); + ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command);
+ server.getPluginManager().callEvent(event); + server.getPluginManager().callEvent(event);
+ if (event.isCancelled()) continue;
+ servercommand = new ServerCommand(event.getCommand(), servercommand.source); + servercommand = new ServerCommand(event.getCommand(), servercommand.source);
+ +
+ // this.getCommandHandler().a(servercommand.source, servercommand.command); // Called in dispatchServerCommand + // this.getCommandHandler().a(servercommand.source, servercommand.command); // Called in dispatchServerCommand
@ -178,7 +179,7 @@
} }
} }
@@ -491,13 +564,60 @@ @@ -491,13 +565,60 @@
} }
public String getPlugins() { public String getPlugins() {