diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-12-11 20:05:48 +0000 |
---|---|---|
committer | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-12-11 20:05:48 +0000 |
commit | b13fd35165a71762111e239c1b3a7501dc457c86 (patch) | |
tree | c0676349b93d87ba1d65266f7bd184cf23bd7e2a /src/main | |
parent | 84699b36a81800a052ed1fc7433c55dcedfd02ca (diff) | |
download | craftbukkit-b13fd35165a71762111e239c1b3a7501dc457c86.tar craftbukkit-b13fd35165a71762111e239c1b3a7501dc457c86.tar.gz craftbukkit-b13fd35165a71762111e239c1b3a7501dc457c86.tar.lz craftbukkit-b13fd35165a71762111e239c1b3a7501dc457c86.tar.xz craftbukkit-b13fd35165a71762111e239c1b3a7501dc457c86.zip |
Re-enable selectors for players and the console using vanilla commands
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java index a6131d6b..3ccbd775 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.command; +import com.google.common.base.Joiner; import java.util.Iterator; import java.util.List; @@ -39,23 +40,7 @@ public final class VanillaCommandWrapper extends VanillaCommand { if (!testPermission(sender)) return true; ICommandListener icommandlistener = getListener(sender); - // Some commands use the worldserver variable but we leave it full of null values, - // so we must temporarily populate it with the world of the commandsender - WorldServer[] prev = MinecraftServer.getServer().worldServer; - MinecraftServer.getServer().worldServer = new WorldServer[]{(WorldServer) icommandlistener.getWorld()}; - try { - vanillaCommand.execute(icommandlistener, args); - } catch (ExceptionUsage exceptionusage) { - ChatMessage chatmessage = new ChatMessage("commands.generic.usage", new Object[] {new ChatMessage(exceptionusage.getMessage(), exceptionusage.getArgs())}); - chatmessage.getChatModifier().setColor(EnumChatFormat.RED); - icommandlistener.sendMessage(chatmessage); - } catch (CommandException commandexception) { - ChatMessage chatmessage = new ChatMessage(commandexception.getMessage(), commandexception.getArgs()); - chatmessage.getChatModifier().setColor(EnumChatFormat.RED); - icommandlistener.sendMessage(chatmessage); - } finally { - MinecraftServer.getServer().worldServer = prev; - } + dispatchVanillaCommand(icommandlistener, args); return true; } @@ -67,14 +52,8 @@ public final class VanillaCommandWrapper extends VanillaCommand { return (List<String>) vanillaCommand.tabComplete(getListener(sender), args, new BlockPosition(0, 0, 0)); } - public final int dispatchVanillaCommandBlock(ICommandListener icommandlistener, String s) { + public final int dispatchVanillaCommand(ICommandListener icommandlistener, String[] as) { // Copied from net.minecraft.server.CommandHandler - s = s.trim(); - if (s.startsWith("/")) { - s = s.substring(1); - } - String as[] = s.split(" "); - as = dropFirstArgument(as); int i = getPlayerListSize(as); int j = 0; // Some commands use the worldserver variable but we leave it full of null values, @@ -174,7 +153,7 @@ public final class VanillaCommandWrapper extends VanillaCommand { return -1; } - private String[] dropFirstArgument(String as[]) { + public static String[] dropFirstArgument(String as[]) { String as1[] = new String[as.length - 1]; for (int i = 1; i < as.length; i++) { as1[i - 1] = as[i]; |