2018-07-15 02:00:00 +02:00
|
|
|
--- a/net/minecraft/server/CommandListenerWrapper.java
|
|
|
|
+++ b/net/minecraft/server/CommandListenerWrapper.java
|
|
|
|
@@ -7,6 +7,7 @@
|
|
|
|
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
|
|
|
import com.mojang.brigadier.suggestion.Suggestions;
|
|
|
|
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
|
|
|
+import com.mojang.brigadier.tree.CommandNode;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.Iterator;
|
2018-12-25 22:00:00 +01:00
|
|
|
@@ -31,6 +32,7 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
private final ResultConsumer<CommandListenerWrapper> l;
|
|
|
|
private final ArgumentAnchor.Anchor m;
|
|
|
|
private final Vec2F n;
|
|
|
|
+ public CommandNode currentCommand; // CraftBukkit
|
|
|
|
|
|
|
|
public CommandListenerWrapper(ICommandListener icommandlistener, Vec3D vec3d, Vec2F vec2f, WorldServer worldserver, int i, String s, IChatBaseComponent ichatbasecomponent, MinecraftServer minecraftserver, @Nullable Entity entity) {
|
2018-12-25 22:00:00 +01:00
|
|
|
this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, (commandcontext, flag, j) -> {
|
2019-01-18 05:59:21 +01:00
|
|
|
@@ -119,9 +121,22 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean hasPermission(int i) {
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (currentCommand != null) {
|
2019-01-18 05:59:21 +01:00
|
|
|
+ return hasPermission(i, org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand));
|
2018-07-15 02:00:00 +02:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
+
|
|
|
|
return this.f >= i;
|
|
|
|
}
|
|
|
|
|
2019-01-18 05:59:21 +01:00
|
|
|
+ // 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 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
public Collection<ICompletionProvider.a> a(boolean flag) {
|
|
|
|
return Collections.singleton(ICompletionProvider.a.b);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ public org.bukkit.command.CommandSender getBukkitSender() {
|
|
|
|
+ return base.getBukkitSender(this);
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|