Apply permission checks to command block executed vanilla commands

This commit is contained in:
Thinkofdeath 2014-12-27 14:58:47 +00:00
parent e1c64bf0eb
commit c806831619
3 changed files with 13 additions and 11 deletions

View file

@ -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);
+ }
+

View file

@ -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;
+ }

View file

@ -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
}
}