2015-05-25 20:37:24 +10:00
--- a/net/minecraft/server/CommandExecute.java
+++ b/net/minecraft/server/CommandExecute.java
2016-05-10 21:47:39 +10:00
@@ -4,6 +4,10 @@
2016-03-01 08:32:46 +11:00
import java.util.Collections;
2015-01-04 23:25:31 +00:00
import java.util.List;
2016-05-10 21:47:39 +10:00
import javax.annotation.Nullable;
2015-01-25 15:17:48 +00:00
+// CraftBukkit start
2015-01-04 23:25:31 +00:00
+import org.bukkit.craftbukkit.command.ProxiedNativeCommandSender;
2015-01-25 15:17:48 +00:00
+import org.bukkit.craftbukkit.command.VanillaCommandWrapper;
+// CraftBukkit end
2015-01-04 23:25:31 +00:00
public class CommandExecute extends CommandAbstract {
2017-06-26 08:27:25 +10:00
@@ -59,26 +63,41 @@
2016-04-20 11:24:48 +01:00
}
String s = a(astring, b0);
2017-05-19 21:00:13 +10:00
- CommandListenerWrapper commandlistenerwrapper = CommandListenerWrapper.a(icommandlistener).a(entity, new Vec3D(d0, d1, d2)).a(minecraftserver.worldServer[0].getGameRules().getBoolean("commandBlockOutput"));
+ CommandListenerWrapper commandlistenerwrapper = CommandListenerWrapper.a(icommandlistener).a(entity, new Vec3D(d0, d1, d2)).a(minecraftserver.worlds.get(0).getGameRules().getBoolean("commandBlockOutput")); // CraftBukkit
2016-03-01 08:32:46 +11:00
ICommandHandler icommandhandler = minecraftserver.getCommandHandler();
2015-01-04 23:25:31 +00:00
try {
2017-05-19 21:00:13 +10:00
- int i = icommandhandler.a(commandlistenerwrapper, s);
2015-01-04 23:25:31 +00:00
+ // CraftBukkit start
2017-06-26 08:27:25 +10:00
+ org.bukkit.command.CommandSender sender = CommandBlockListenerAbstract.unwrapSender(icommandlistener);
2017-05-19 21:00:13 +10:00
+ int i = CommandBlockListenerAbstract.executeCommand(commandlistenerwrapper, new ProxiedNativeCommandSender(commandlistenerwrapper, sender, entity.getBukkitEntity()), s);
2015-01-04 23:25:31 +00:00
+ // CraftBukkit end
2015-02-26 22:41:06 +00:00
2016-11-17 12:41:03 +11:00
if (i < 1) {
2015-01-04 23:25:31 +00:00
throw new CommandException("commands.execute.allInvocationsFailed", new Object[] { s});
}
} catch (Throwable throwable) {
+ // CraftBukkit start
+ if (throwable instanceof CommandException) {
+ throw (CommandException) throwable;
+ }
+ // CraftBukkit end
throw new CommandException("commands.execute.failed", new Object[] { s, entity.getName()});
}
}
2016-03-01 08:32:46 +11:00
}
2016-05-10 21:47:39 +10:00
public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, @Nullable BlockPosition blockposition) {
2016-03-01 08:32:46 +11:00
- return astring.length == 1 ? a(astring, minecraftserver.getPlayers()) : (astring.length > 1 && astring.length <= 4 ? a(astring, 1, blockposition) : (astring.length > 5 && astring.length <= 8 && "detect".equals(astring[4]) ? a(astring, 5, blockposition) : (astring.length == 9 && "detect".equals(astring[4]) ? a(astring, (Collection) Block.REGISTRY.keySet()) : Collections.emptyList())));
+ return astring.length == 1 ? a(astring, minecraftserver.getPlayers()) : (astring.length > 1 && astring.length <= 4 ? a(astring, 1, blockposition) : (astring.length > 5 && astring.length <= 8 && "detect".equals(astring[4]) ? a(astring, 5, blockposition) : (astring.length == 9 && "detect".equals(astring[4]) ? a(astring, (Collection) Block.REGISTRY.keySet()) : Collections.<String>emptyList()))); // CraftBukkit - decompile error
}
2015-01-04 23:25:31 +00:00
public boolean isListStart(String[] astring, int i) {
return i == 0;
}
+
+ // CraftBukkit start - fix decompiler error
+ @Override
2015-02-26 22:41:06 +00:00
+ public int compareTo(ICommand o) {
2015-01-04 23:25:31 +00:00
+ return a((ICommand) o);
+ }
+ // CraftBukkit end
}