diff --git a/nms-patches/CommandListenerWrapper.patch b/nms-patches/CommandListenerWrapper.patch index df7c9051ce..538af9e8d7 100644 --- a/nms-patches/CommandListenerWrapper.patch +++ b/nms-patches/CommandListenerWrapper.patch @@ -16,11 +16,12 @@ public CommandListenerWrapper(ICommandListener icommandlistener, Vec3D vec3d, Vec2F vec2f, WorldServer worldserver, int i, String s, IChatBaseComponent ichatbasecomponent, MinecraftServer minecraftserver, @Nullable Entity entity) { this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, (commandcontext, flag, j) -> { -@@ -128,9 +130,22 @@ +@@ -128,9 +130,23 @@ @Override public boolean hasPermission(int i) { + // CraftBukkit start ++ CommandNode currentCommand = this.currentCommand; + if (currentCommand != null) { + return hasPermission(i, org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand)); + } @@ -39,7 +40,7 @@ public Vec3D getPosition() { return this.d; } -@@ -192,7 +207,7 @@ +@@ -192,7 +208,7 @@ while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); @@ -48,7 +49,7 @@ entityplayer.sendMessage(ichatmutablecomponent, SystemUtils.b); } } -@@ -252,4 +267,10 @@ +@@ -252,4 +268,10 @@ public IRegistryCustom q() { return this.i.aX(); } diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java index 5b30532093..1685522b49 100644 --- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java +++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java @@ -71,8 +71,8 @@ public abstract class CommandNode implements Comparable> { return modifier; } - public boolean canUse(final S source) { - // CraftBukkit start + // CraftBukkit start + public synchronized boolean canUse(final S source) { if (source instanceof CommandListenerWrapper) { try { ((CommandListenerWrapper) source).currentCommand = this;