mirror of https://github.com/PaperMC/Paper.git
69 lines
2.9 KiB
Diff
69 lines
2.9 KiB
Diff
--- a/net/minecraft/commands/CommandSourceStack.java
|
|
+++ b/net/minecraft/commands/CommandSourceStack.java
|
|
@@ -44,6 +43,7 @@
|
|
import net.minecraft.world.level.dimension.DimensionType;
|
|
import net.minecraft.world.phys.Vec2;
|
|
import net.minecraft.world.phys.Vec3;
|
|
+import com.mojang.brigadier.tree.CommandNode; // CraftBukkit
|
|
|
|
public class CommandSourceStack implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider {
|
|
|
|
@@ -64,6 +64,7 @@
|
|
private final Vec2 rotation;
|
|
private final CommandSigningContext signingContext;
|
|
private final TaskChainer chatMessageChainer;
|
|
+ public volatile CommandNode currentCommand; // CraftBukkit
|
|
|
|
public CommandSourceStack(CommandSource commandsource, Vec3 vec3, Vec2 vec2, ServerLevel serverlevel, int i, String s, Component component, MinecraftServer minecraftserver, @Nullable Entity entity) {
|
|
this(commandsource, vec3, vec2, serverlevel, i, s, component, minecraftserver, entity, false, CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(minecraftserver));
|
|
@@ -170,11 +170,24 @@
|
|
}
|
|
|
|
@Override
|
|
- @Override
|
|
- public boolean hasPermission(int i) {
|
|
- return this.permissionLevel >= i;
|
|
+ public boolean hasPermission(int level) {
|
|
+ // CraftBukkit start
|
|
+ CommandNode currentCommand = this.currentCommand;
|
|
+ if (currentCommand != null) {
|
|
+ return hasPermission(level, org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand));
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
+ return this.permissionLevel >= level;
|
|
}
|
|
|
|
+ // CraftBukkit start
|
|
+ public boolean hasPermission(int i, String bukkitPermission) {
|
|
+ // World is null when loading functions
|
|
+ return ((getLevel() == null || !getLevel().getCraftServer().ignoreVanillaPermissions) && this.permissionLevel >= i) || getBukkitSender().hasPermission(bukkitPermission);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public Vec3 getPosition() {
|
|
return this.worldPosition;
|
|
}
|
|
@@ -307,8 +320,8 @@
|
|
while (iterator.hasNext()) {
|
|
ServerPlayer serverplayer = (ServerPlayer) iterator.next();
|
|
|
|
- if (serverplayer != this.source && this.server.getPlayerList().isOp(serverplayer.getGameProfile())) {
|
|
- serverplayer.sendSystemMessage(mutablecomponent);
|
|
+ if (entityplayer != this.source && entityplayer.getBukkitEntity().hasPermission("minecraft.admin.command_feedback")) { // CraftBukkit
|
|
+ entityplayer.sendSystemMessage(ichatmutablecomponent);
|
|
}
|
|
}
|
|
}
|
|
@@ -413,4 +413,10 @@
|
|
public boolean isSilent() {
|
|
return this.silent;
|
|
}
|
|
+
|
|
+ // CraftBukkit start
|
|
+ public org.bukkit.command.CommandSender getBukkitSender() {
|
|
+ return source.getBukkitSender(this);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|