Fix minecraft.command.selector permission

This commit is contained in:
md_5
2019-01-18 15:59:21 +11:00
parent 47b06d5b4e
commit 7fc66b28db
2 changed files with 33 additions and 4 deletions

View File

@@ -16,21 +16,30 @@
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) -> {
@@ -119,6 +121,13 @@
@@ -119,9 +121,22 @@
}
public boolean hasPermission(int i) {
+ // CraftBukkit start
+ if (currentCommand != null) {
+ // World is null when loading functions
+ return ((getWorld() == null || !getWorld().getServer().ignoreVanillaPermissions) && this.f >= i) || getBukkitSender().hasPermission(org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand));
+ return hasPermission(i, org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand));
+ }
+ // CraftBukkit end
+
return this.f >= i;
}
@@ -232,4 +241,10 @@
+ // CraftBukkit start
+ public boolean hasPermission(int i, String bukkitPermission) {
+ // World is null when loading functions
+ return ((getWorld() == null || !getWorld().getServer().ignoreVanillaPermissions) && this.f >= i) || getBukkitSender().hasPermission(bukkitPermission);
+ }
+ // CraftBukkit end
+
public Vec3D getPosition() {
return this.d;
}
@@ -232,4 +247,10 @@
public Collection<ICompletionProvider.a> a(boolean flag) {
return Collections.singleton(ICompletionProvider.a.b);
}