Re-enable selectors for players and the console using vanilla commands

By: Thinkofdeath <thinkofdeath@spigotmc.org>
This commit is contained in:
CraftBukkit/Spigot
2014-12-11 20:05:48 +00:00
parent 7d1aaec723
commit f337b96b9e
3 changed files with 17 additions and 44 deletions

View File

@@ -1,5 +1,5 @@
--- ../work/decompile-8eb82bde//net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-05 23:10:24.921614234 +0000
+++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-05 23:04:53.325621594 +0000
--- ../work/decompile-8eb82bde/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-11 20:04:50.493619968 +0000
+++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-11 20:02:45.005621331 +0000
@@ -4,6 +4,13 @@
import java.util.Date;
import java.util.concurrent.Callable;
@@ -34,7 +34,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Executing command block");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed");
@@ -91,8 +102,123 @@
@@ -91,8 +102,129 @@
} else {
this.b = 0;
}
@@ -69,7 +69,13 @@
+ commandBlockCommand = commandMap.getCommand("minecraft:" + args[0]);
+ }
+ if (commandBlockCommand instanceof VanillaCommandWrapper) {
+ return ((VanillaCommandWrapper) commandBlockCommand).dispatchVanillaCommandBlock(sender, command);
+ command = command.trim();
+ if (command.startsWith("/")) {
+ command = command.substring(1);
+ }
+ String as[] = command.split(" ");
+ as = VanillaCommandWrapper.dropFirstArgument(as);
+ return ((VanillaCommandWrapper) commandBlockCommand).dispatchVanillaCommand(sender, as);
+ }
+
+ // Make sure this is a valid command

View File

@@ -1,18 +1,6 @@
--- ../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 @@
}
public static List getPlayers(ICommandListener icommandlistener, String s, Class oclass) {
+ // CraftBukkit start - disable playerselections for ICommandListeners other than command blocks
+ if (!(icommandlistener instanceof CommandBlockListenerAbstract)) {
+ return com.google.common.collect.ImmutableList.of();
+ }
+ // CraftBukkit end
Matcher matcher = PlayerSelector.a.matcher(s);
if (matcher.matches() && icommandlistener.a(1, "@")) {
@@ -97,7 +102,7 @@
--- ../work/decompile-8eb82bde/net/minecraft/server/PlayerSelector.java 2014-12-11 20:04:51.273619960 +0000
+++ src/main/java/net/minecraft/server/PlayerSelector.java 2014-12-11 20:03:19.893620952 +0000
@@ -97,7 +97,7 @@
if (h(map)) {
arraylist.add(icommandlistener.getWorld());
} else {