Archiviert
13
0

SPIGOT-3456: Expand calling of ServerCommandEvent

Existing usage preserved by checking sender.
Dieser Commit ist enthalten in:
md_5 2017-07-28 18:10:38 +10:00
Ursprung d00c0574cd
Commit 2c5c611d0c

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandBlockListenerAbstract.java --- a/net/minecraft/server/CommandBlockListenerAbstract.java
+++ b/net/minecraft/server/CommandBlockListenerAbstract.java +++ b/net/minecraft/server/CommandBlockListenerAbstract.java
@@ -4,6 +4,14 @@ @@ -4,6 +4,15 @@
import java.util.Date; import java.util.Date;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -10,12 +10,13 @@
+import com.google.common.base.Joiner; +import com.google.common.base.Joiner;
+import java.util.logging.Level; +import java.util.logging.Level;
+import org.bukkit.command.CommandSender; +import org.bukkit.command.CommandSender;
+import org.bukkit.event.server.ServerCommandEvent;
+// CraftBukkit end +// CraftBukkit end
+ +
public abstract class CommandBlockListenerAbstract implements ICommandListener { public abstract class CommandBlockListenerAbstract implements ICommandListener {
private static final SimpleDateFormat a = new SimpleDateFormat("HH:mm:ss"); private static final SimpleDateFormat a = new SimpleDateFormat("HH:mm:ss");
@@ -15,6 +23,7 @@ @@ -15,6 +24,7 @@
private String g = ""; private String g = "";
private String h = "@"; private String h = "@";
private final CommandObjectiveExecutor i = new CommandObjectiveExecutor(); private final CommandObjectiveExecutor i = new CommandObjectiveExecutor();
@ -23,7 +24,7 @@
public CommandBlockListenerAbstract() {} public CommandBlockListenerAbstract() {}
@@ -107,7 +116,9 @@ @@ -107,7 +117,9 @@
if (minecraftserver != null && minecraftserver.M() && minecraftserver.getEnableCommandBlock()) { if (minecraftserver != null && minecraftserver.M() && minecraftserver.getEnableCommandBlock()) {
try { try {
this.f = null; this.f = null;
@ -34,7 +35,7 @@
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Executing command block"); CrashReport crashreport = CrashReport.a(throwable, "Executing command block");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed");
@@ -149,6 +160,163 @@ @@ -149,6 +161,171 @@
} }
} }
@ -58,6 +59,14 @@
+ if (command.startsWith("/")) { + if (command.startsWith("/")) {
+ command = command.substring(1); + command = command.substring(1);
+ } + }
+
+ ServerCommandEvent event = new ServerCommandEvent(bSender, command);
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return 0;
+ }
+ command = event.getCommand();
+
+ String[] args = command.split(" "); + String[] args = command.split(" ");
+ ArrayList<String[]> commands = new ArrayList<String[]>(); + ArrayList<String[]> commands = new ArrayList<String[]>();
+ +