Commits
1 - | --- ../work/decompile-8eb82bde/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-23 01:00:07.818620695 +0000 |
2 - | +++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-23 01:00:07.818620695 +0000 |
1 + | --- ../work/decompile-8eb82bde//net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-27 14:58:24.901254690 +0000 |
2 + | +++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-27 14:58:24.905254690 +0000 |
3 3 | |
4 4 | import java.util.Date; |
5 5 | import java.util.concurrent.Callable; |
6 6 | |
7 7 | +// CraftBukkit start |
8 8 | +import java.util.ArrayList; |
9 9 | +import org.apache.logging.log4j.Level; |
10 10 | +import org.bukkit.craftbukkit.command.VanillaCommandWrapper; |
11 11 | +import com.google.common.base.Joiner; |
12 12 | +// CraftBukkit end |
27 27 | try { |
28 28 | this.d = null; |
29 29 | - this.b = icommandhandler.a(this, this.e); |
30 30 | + // this.b = icommandhandler.a(this, this.e); |
31 31 | + // CraftBukkit start - Handle command block commands using Bukkit dispatcher |
32 32 | + this.b= executeCommand(this, sender, this.e); |
33 33 | + // CraftBukkit end |
34 34 | } catch (Throwable throwable) { |
35 35 | CrashReport crashreport = CrashReport.a(throwable, "Executing command block"); |
36 36 | CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed"); |
37 - | |
37 + | |
38 38 | } else { |
39 39 | this.b = 0; |
40 40 | } |
41 41 | + } |
42 42 | + |
43 43 | + // CraftBukkit start |
44 44 | + |
45 45 | + public static int executeCommand(ICommandListener sender, org.bukkit.command.CommandSender bSender, String command) { |
46 46 | + org.bukkit.command.SimpleCommandMap commandMap = sender.getWorld().getServer().getCommandMap(); |
47 47 | + Joiner joiner = Joiner.on(" "); |
72 72 | + if (sender.getWorld().getServer().getCommandBlockOverride(args[0])) { |
73 73 | + commandBlockCommand = commandMap.getCommand("minecraft:" + args[0]); |
74 74 | + } |
75 75 | + if (commandBlockCommand instanceof VanillaCommandWrapper) { |
76 76 | + command = command.trim(); |
77 77 | + if (command.startsWith("/")) { |
78 78 | + command = command.substring(1); |
79 79 | + } |
80 80 | + String as[] = command.split(" "); |
81 81 | + as = VanillaCommandWrapper.dropFirstArgument(as); |
82 + | + if (!((VanillaCommandWrapper) commandBlockCommand).testPermission(bSender)) { |
83 + | + return 0; |
84 + | + } |
82 85 | + return ((VanillaCommandWrapper) commandBlockCommand).dispatchVanillaCommand(sender, as); |
83 86 | + } |
84 87 | + |
85 88 | + // Make sure this is a valid command |
86 89 | + if (commandMap.getCommand(args[0]) == null) { |
87 90 | + return 0; |
88 91 | + } |
89 92 | + |
90 93 | + // testfor command requires special handling |
91 94 | + if (args[0].equalsIgnoreCase("testfor")) { |