mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-02 13:12:03 -07:00
Remap CraftBukkit to Mojang+Yarn Mappings
By: Initial Source <noreply+automated@papermc.io>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
--- a/net/minecraft/commands/CommandSourceStack.java
|
||||
+++ b/net/minecraft/commands/CommandSourceStack.java
|
||||
@@ -45,6 +45,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 {
|
||||
|
||||
@@ -65,6 +66,7 @@
|
||||
private final Vec2 rotation;
|
||||
private final CommandSigningContext signingContext;
|
||||
private final TaskChainer chatMessageChainer;
|
||||
+ public volatile CommandNode currentCommand; // CraftBukkit
|
||||
|
||||
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
|
||||
this(output, pos, rot, world, level, name, displayName, server, entity, false, CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(server));
|
||||
@@ -171,8 +173,22 @@
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(int level) {
|
||||
+ // CraftBukkit start
|
||||
+ CommandNode currentCommand = this.currentCommand;
|
||||
+ if (currentCommand != null) {
|
||||
+ return this.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 ((this.getLevel() == null || !this.getLevel().getCraftServer().ignoreVanillaPermissions) && this.permissionLevel >= i) || this.getBukkitSender().hasPermission(bukkitPermission);
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
public Vec3 getPosition() {
|
||||
return this.worldPosition;
|
||||
@@ -302,7 +318,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
|
||||
|
||||
- if (entityplayer.commandSource() != this.source && this.server.getPlayerList().isOp(entityplayer.getGameProfile())) {
|
||||
+ if (entityplayer.commandSource() != this.source && entityplayer.getBukkitEntity().hasPermission("minecraft.admin.command_feedback")) { // CraftBukkit
|
||||
entityplayer.sendSystemMessage(ichatmutablecomponent);
|
||||
}
|
||||
}
|
||||
@@ -400,4 +416,10 @@
|
||||
public boolean isSilent() {
|
||||
return this.silent;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public org.bukkit.command.CommandSender getBukkitSender() {
|
||||
+ return this.source.getBukkitSender(this);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
Reference in New Issue
Block a user