diff options
author | md_5 <git@md-5.net> | 2017-07-28 18:10:38 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2017-07-28 18:10:38 +1000 |
commit | 2c5c611d0c3c198c1ac904e8d64051a8437a8720 (patch) | |
tree | 705f4189a1e19b749676156e3a733738725ff1e4 | |
parent | d00c0574cdfff2e4e330c683565e7e59d09ee852 (diff) | |
download | craftbukkit-2c5c611d0c3c198c1ac904e8d64051a8437a8720.tar craftbukkit-2c5c611d0c3c198c1ac904e8d64051a8437a8720.tar.gz craftbukkit-2c5c611d0c3c198c1ac904e8d64051a8437a8720.tar.lz craftbukkit-2c5c611d0c3c198c1ac904e8d64051a8437a8720.tar.xz craftbukkit-2c5c611d0c3c198c1ac904e8d64051a8437a8720.zip |
SPIGOT-3456: Expand calling of ServerCommandEvent
Existing usage preserved by checking sender.
-rw-r--r-- | nms-patches/CommandBlockListenerAbstract.patch | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/nms-patches/CommandBlockListenerAbstract.patch b/nms-patches/CommandBlockListenerAbstract.patch index ba41673f..5f6ef041 100644 --- a/nms-patches/CommandBlockListenerAbstract.patch +++ b/nms-patches/CommandBlockListenerAbstract.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CommandBlockListenerAbstract.java +++ b/net/minecraft/server/CommandBlockListenerAbstract.java -@@ -4,6 +4,14 @@ +@@ -4,6 +4,15 @@ import java.util.Date; import javax.annotation.Nullable; @@ -10,12 +10,13 @@ +import com.google.common.base.Joiner; +import java.util.logging.Level; +import org.bukkit.command.CommandSender; ++import org.bukkit.event.server.ServerCommandEvent; +// CraftBukkit end + public abstract class CommandBlockListenerAbstract implements ICommandListener { private static final SimpleDateFormat a = new SimpleDateFormat("HH:mm:ss"); -@@ -15,6 +23,7 @@ +@@ -15,6 +24,7 @@ private String g = ""; private String h = "@"; private final CommandObjectiveExecutor i = new CommandObjectiveExecutor(); @@ -23,7 +24,7 @@ public CommandBlockListenerAbstract() {} -@@ -107,7 +116,9 @@ +@@ -107,7 +117,9 @@ if (minecraftserver != null && minecraftserver.M() && minecraftserver.getEnableCommandBlock()) { try { this.f = null; @@ -34,7 +35,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Executing command block"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed"); -@@ -149,6 +160,163 @@ +@@ -149,6 +161,171 @@ } } @@ -58,6 +59,14 @@ + if (command.startsWith("/")) { + 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(" "); + ArrayList<String[]> commands = new ArrayList<String[]>(); + |