aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2023-06-28 23:18:28 -0700
committerGitHub <[email protected]>2023-06-28 23:18:28 -0700
commit437e8da700276d83f435f2d84295fbbc55a07f9c (patch)
treee2c37fc8709be0575f28213812411e3d0c69b453
parent2c9c5e466293280fddb49d295ed212b051987dc3 (diff)
downloadPaper-437e8da700276d83f435f2d84295fbbc55a07f9c.tar.gz
Paper-437e8da700276d83f435f2d84295fbbc55a07f9c.zip
Improve command function perm level checks (#9411)
-rw-r--r--patches/server/0982-Improve-command-function-perm-level-checks.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/patches/server/0982-Improve-command-function-perm-level-checks.patch b/patches/server/0982-Improve-command-function-perm-level-checks.patch
new file mode 100644
index 0000000000..460d87d02c
--- /dev/null
+++ b/patches/server/0982-Improve-command-function-perm-level-checks.patch
@@ -0,0 +1,27 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+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
+