From 50da2cdec30f2684f91b04e9c442138c278769b4 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 22 Aug 2020 18:19:25 +1000 Subject: [PATCH] SPIGOT-6094: Error loading datapack functions --- nms-patches/CommandListenerWrapper.patch | 7 ++++--- src/main/java/com/mojang/brigadier/tree/CommandNode.java | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) 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;