From c80683161952dcd465a9e9514daf488c1177b944 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sat, 27 Dec 2014 14:58:47 +0000 Subject: Apply permission checks to command block executed vanilla commands --- nms-patches/CommandBlockListenerAbstract.patch | 9 ++++++--- nms-patches/TileEntityBeacon.patch | 9 ++++----- nms-patches/TileEntitySign.patch | 6 +++--- 3 files changed, 13 insertions(+), 11 deletions(-) (limited to 'nms-patches') diff --git a/nms-patches/CommandBlockListenerAbstract.patch b/nms-patches/CommandBlockListenerAbstract.patch index 51525923..9d672ec4 100644 --- a/nms-patches/CommandBlockListenerAbstract.patch +++ b/nms-patches/CommandBlockListenerAbstract.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-23 01:00:07.818620695 +0000 -+++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-23 01:00:07.818620695 +0000 +--- ../work/decompile-8eb82bde//net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-27 14:58:24.901254690 +0000 ++++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2014-12-27 14:58:24.905254690 +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,133 @@ +@@ -91,8 +102,136 @@ } else { this.b = 0; } @@ -79,6 +79,9 @@ + } + String as[] = command.split(" "); + as = VanillaCommandWrapper.dropFirstArgument(as); ++ if (!((VanillaCommandWrapper) commandBlockCommand).testPermission(bSender)) { ++ return 0; ++ } + return ((VanillaCommandWrapper) commandBlockCommand).dispatchVanillaCommand(sender, as); + } + diff --git a/nms-patches/TileEntityBeacon.patch b/nms-patches/TileEntityBeacon.patch index 0bee0bf3..5091f62b 100644 --- a/nms-patches/TileEntityBeacon.patch +++ b/nms-patches/TileEntityBeacon.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityBeacon.java 2014-12-27 14:48:34.677261097 +0000 -+++ src/main/java/net/minecraft/server/TileEntityBeacon.java 2014-12-27 14:48:34.677261097 +0000 +--- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityBeacon.java 2014-12-27 14:58:26.269254675 +0000 ++++ src/main/java/net/minecraft/server/TileEntityBeacon.java 2014-12-27 14:58:26.269254675 +0000 @@ -5,6 +5,11 @@ import java.util.Iterator; import java.util.List; @@ -77,7 +77,7 @@ } } -@@ -307,4 +336,24 @@ +@@ -307,4 +336,23 @@ return super.c(i, j); } } @@ -93,8 +93,7 @@ + case 5: // MobEffectList.INCREASE_DAMAGE.id + case 10: // MobEffectList.REGENERATION.id + break; -+ default: -+ System.out.println("Filtered: " + i); ++ default: + i = 0; + break; + } diff --git a/nms-patches/TileEntitySign.patch b/nms-patches/TileEntitySign.patch index 56bcc1fe..4877eea0 100644 --- a/nms-patches/TileEntitySign.patch +++ b/nms-patches/TileEntitySign.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntitySign.java 2014-12-05 23:10:25.877614213 +0000 -+++ src/main/java/net/minecraft/server/TileEntitySign.java 2014-12-05 23:06:56.609618857 +0000 +--- ../work/decompile-8eb82bde//net/minecraft/server/TileEntitySign.java 2014-12-27 14:58:26.377254674 +0000 ++++ src/main/java/net/minecraft/server/TileEntitySign.java 2014-12-27 14:58:26.381254674 +0000 @@ -20,6 +20,12 @@ nbttagcompound.setString("Text" + (i + 1), s); @@ -48,7 +48,7 @@ - MinecraftServer.getServer().getCommandHandler().a(tileentitysignplayerwrapper, chatclickable.b()); + // CraftBukkit start + // MinecraftServer.getServer().getCommandHandler().a(tileentitysignplayerwrapper, chatclickable.b()); -+ CommandBlockListenerAbstract.executeCommand(tileentitysignplayerwrapper, (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), chatclickable.b()); ++ CommandBlockListenerAbstract.executeCommand(entityhuman, (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), chatclickable.b()); + // CraftBukkit ebd } } -- cgit v1.2.3