Paper/patches/server/0975-Improve-command-function-perm-level-checks.patch
Noah van der Aa b8edb0e130
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9648)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
6b34da8f SPIGOT-7467: Add getAddress to RemoteConsoleCommandSender

CraftBukkit Changes:
db4ba2897 SPIGOT-7467: Add getAddress to RemoteConsoleCommandSender
4f7ff4dec PR-1246: Add missing AbstractTestingBase to tests which need them
f70a7b68d SPIGOT-7465, MC-264979: Fresh installations print NoSuchFileException for server.properties
8ef7afef6 PR-1240: Call BlockGrowEvent for vines that are growing on additional sides of an existing vine block

Spigot Changes:
d2eba2c8 Rebuild patches
2023-08-28 13:05:48 +02:00

28 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 27 Jun 2023 16:32:39 -0700
Subject: [PATCH] Improve command function perm level checks
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index 43c71d9bf2eac98023057b4483fdd143a8343e98..0de2eae2d448ac9e269a4edf48406d5ea8af8059 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -216,8 +216,14 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
// 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
+ boolean hasPermissionLevel = this.permissionLevel >= i;
+ if (this.source == CommandSource.NULL) {
+ return hasPermissionLevel;
+ } else {
+ return (!this.getLevel().getCraftServer().ignoreVanillaPermissions && hasPermissionLevel) || this.getBukkitSender().hasPermission(bukkitPermission);
+ }
+ // Paper end
}
// CraftBukkit end