From 6671a56ff869f9ccd3236279bdb3af8e3c41b21b Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 28 Jun 2023 23:18:28 -0700 Subject: [PATCH] Improve command function perm level checks (#9411) --- ...e-command-function-perm-level-checks.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 patches/server/Improve-command-function-perm-level-checks.patch diff --git a/patches/server/Improve-command-function-perm-level-checks.patch b/patches/server/Improve-command-function-perm-level-checks.patch new file mode 100644 index 0000000000..84cd183774 --- /dev/null +++ b/patches/server/Improve-command-function-perm-level-checks.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java ++++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java +@@ -0,0 +0,0 @@ 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 +