Commits
1 - | --- ../work/decompile-8eb82bde//net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-05 23:10:24.921614234 +0000 |
2 - | +++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-05 23:04:53.325621594 +0000 |
1 + | --- ../work/decompile-8eb82bde/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-11 20:04:50.493619968 +0000 |
2 + | +++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-11 20:02:45.005621331 +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(" "); |
62 62 | + if (sender.getWorld().players.isEmpty()) { |
63 63 | + return 0; |
64 64 | + } |
65 65 | + |
66 66 | + // Handle vanilla commands; |
67 67 | + org.bukkit.command.Command commandBlockCommand = commandMap.getCommand(args[0]); |
68 68 | + if (sender.getWorld().getServer().getCommandBlockOverride(args[0])) { |
69 69 | + commandBlockCommand = commandMap.getCommand("minecraft:" + args[0]); |
70 70 | + } |
71 71 | + if (commandBlockCommand instanceof VanillaCommandWrapper) { |
72 - | + return ((VanillaCommandWrapper) commandBlockCommand).dispatchVanillaCommandBlock(sender, command); |
72 + | + command = command.trim(); |
73 + | + if (command.startsWith("/")) { |
74 + | + command = command.substring(1); |
75 + | + } |
76 + | + String as[] = command.split(" "); |
77 + | + as = VanillaCommandWrapper.dropFirstArgument(as); |
78 + | + return ((VanillaCommandWrapper) commandBlockCommand).dispatchVanillaCommand(sender, as); |
73 79 | + } |
74 80 | + |
75 81 | + // Make sure this is a valid command |
76 82 | + if (commandMap.getCommand(args[0]) == null) { |
77 83 | + return 0; |
78 84 | + } |
79 85 | + |
80 86 | + // testfor command requires special handling |
81 87 | + if (args[0].equalsIgnoreCase("testfor")) { |
82 88 | + if (args.length < 2) { |