From 2422099346777b0c5ba4cf086d8cac24f9238b97 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Tue, 2 Dec 2014 20:24:03 +0000 Subject: [PATCH] Fix selectors in non-bukkit commands for command blocks --- nms-patches/CommandBlockListenerAbstract.patch | 9 +++++---- nms-patches/PlayerSelector.patch | 13 +++++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/nms-patches/CommandBlockListenerAbstract.patch b/nms-patches/CommandBlockListenerAbstract.patch index 0bad2a434e..aacf5ff830 100644 --- a/nms-patches/CommandBlockListenerAbstract.patch +++ b/nms-patches/CommandBlockListenerAbstract.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/CommandBlockListenerAbstract.java 2014-11-28 20:19:48.021499587 +0000 -+++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2014-11-28 20:18:58.289500691 +0000 +--- ../work/decompile-8eb82bde//net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-02 20:23:51.921621335 +0000 ++++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-02 20:23:10.809622247 +0000 @@ -4,6 +4,13 @@ import java.util.Date; import java.util.concurrent.Callable; @@ -134,7 +134,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Executing command block"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed"); -@@ -91,8 +202,26 @@ +@@ -91,8 +202,27 @@ } else { this.b = 0; } @@ -143,7 +143,8 @@ + // CraftBukkit start + private ArrayList buildCommands(String[] args, int pos) { + ArrayList commands = new ArrayList(); -+ EntityPlayer[] players = ((java.util.List)PlayerSelector.getPlayers(this, args[pos], EntityPlayer.class)).toArray(new EntityPlayer[0]); ++ java.util.List players = (java.util.List)PlayerSelector.getPlayers(this, args[pos], EntityPlayer.class); ++ + if (players != null) { + for (EntityPlayer player : players) { + if (player.world != this.getWorld()) { diff --git a/nms-patches/PlayerSelector.patch b/nms-patches/PlayerSelector.patch index e7d05e5247..a31e8db628 100644 --- a/nms-patches/PlayerSelector.patch +++ b/nms-patches/PlayerSelector.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PlayerSelector.java 2014-11-28 17:43:43.337707430 +0000 -+++ src/main/java/net/minecraft/server/PlayerSelector.java 2014-11-28 17:38:17.000000000 +0000 +--- ../work/decompile-8eb82bde//net/minecraft/server/PlayerSelector.java 2014-12-02 20:23:52.649621319 +0000 ++++ src/main/java/net/minecraft/server/PlayerSelector.java 2014-12-02 20:22:46.409622789 +0000 @@ -52,6 +52,11 @@ } @@ -12,3 +12,12 @@ Matcher matcher = PlayerSelector.a.matcher(s); if (matcher.matches() && icommandlistener.a(1, "@")) { +@@ -97,7 +102,7 @@ + if (h(map)) { + arraylist.add(icommandlistener.getWorld()); + } else { +- Collections.addAll(arraylist, MinecraftServer.getServer().worldServer); ++ arraylist.addAll(MinecraftServer.getServer().worlds); // CraftBukkit + } + + return arraylist;