[ci skip] Add more patch identifying comments, merge related patches

This commit is contained in:
Nassim Jahnke
2024-01-15 12:38:39 +01:00
parent 44f3ecd436
commit 64b98ef110
29 changed files with 147 additions and 147 deletions

View File

@@ -12,17 +12,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.permissionLevel >= level;
}
+ // Paper start
+ // Paper start - Fix permission levels for command blocks
+ private boolean forceRespectPermissionLevel() {
+ return this.source == CommandSource.NULL || (this.source instanceof final net.minecraft.world.level.BaseCommandBlock commandBlock && commandBlock.getLevel().paperConfig().commandBlocks.forceFollowPermLevel);
+ }
+ // Paper end
+ // Paper end - Fix permission levels for command blocks
+
// 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);
+ // Paper start
+ // Paper start - Fix permission levels for command blocks
+ final java.util.function.BooleanSupplier hasBukkitPerm = () -> this.source == CommandSource.NULL /*treat NULL as having all bukkit perms*/ || this.getBukkitSender().hasPermission(bukkitPermission); // lazily check bukkit perms to the benefit of custom permission setups
+ // if the server is null, we must check the vanilla perm level system
+ // if ignoreVanillaPermissions is true, we can skip vanilla perms and just run the bukkit perm check
@@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+ return hasBukkitPerm.getAsBoolean();
+ // Paper end
+ // Paper end - Fix permission levels for command blocks
}
// CraftBukkit end
@@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- || cmd.equalsIgnoreCase("pardon") || cmd.equalsIgnoreCase("pardon-ip") || cmd.equalsIgnoreCase("reload")) {
- return;
- }
+ // Paper - use proper permission levels to block these commands
+ // Paper - Fix permission levels for command blocks
// Handle vanilla commands;
if (sender.getLevel().getCraftServer().getCommandBlockOverride(args[0])) {