Commits

md_5 authored 50da2cdec30
SPIGOT-6094: Error loading datapack functions
No tags

nms-patches/CommandListenerWrapper.patch

Modified
9 9 import java.util.Iterator;
10 10 import java.util.Set;
11 11 @@ -32,6 +33,7 @@
12 12 private final ResultConsumer<CommandListenerWrapper> l;
13 13 private final ArgumentAnchor.Anchor m;
14 14 private final Vec2F n;
15 15 + public CommandNode currentCommand; // CraftBukkit
16 16
17 17 public CommandListenerWrapper(ICommandListener icommandlistener, Vec3D vec3d, Vec2F vec2f, WorldServer worldserver, int i, String s, IChatBaseComponent ichatbasecomponent, MinecraftServer minecraftserver, @Nullable Entity entity) {
18 18 this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, (commandcontext, flag, j) -> {
19 -@@ -128,9 +130,22 @@
19 +@@ -128,9 +130,23 @@
20 20
21 21 @Override
22 22 public boolean hasPermission(int i) {
23 23 + // CraftBukkit start
24 ++ CommandNode currentCommand = this.currentCommand;
24 25 + if (currentCommand != null) {
25 26 + return hasPermission(i, org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand));
26 27 + }
27 28 + // CraftBukkit end
28 29 +
29 30 return this.f >= i;
30 31 }
31 32
32 33 + // CraftBukkit start
33 34 + public boolean hasPermission(int i, String bukkitPermission) {
34 35 + // World is null when loading functions
35 36 + return ((getWorld() == null || !getWorld().getServer().ignoreVanillaPermissions) && this.f >= i) || getBukkitSender().hasPermission(bukkitPermission);
36 37 + }
37 38 + // CraftBukkit end
38 39 +
39 40 public Vec3D getPosition() {
40 41 return this.d;
41 42 }
42 -@@ -192,7 +207,7 @@
43 +@@ -192,7 +208,7 @@
43 44 while (iterator.hasNext()) {
44 45 EntityPlayer entityplayer = (EntityPlayer) iterator.next();
45 46
46 47 - if (entityplayer != this.base && this.i.getPlayerList().isOp(entityplayer.getProfile())) {
47 48 + if (entityplayer != this.base && entityplayer.getBukkitEntity().hasPermission("minecraft.admin.command_feedback")) { // CraftBukkit
48 49 entityplayer.sendMessage(ichatmutablecomponent, SystemUtils.b);
49 50 }
50 51 }
51 -@@ -252,4 +267,10 @@
52 +@@ -252,4 +268,10 @@
52 53 public IRegistryCustom q() {
53 54 return this.i.aX();
54 55 }
55 56 +
56 57 + // CraftBukkit start
57 58 + public org.bukkit.command.CommandSender getBukkitSender() {
58 59 + return base.getBukkitSender(this);
59 60 + }
60 61 + // CraftBukkit end
61 62 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut