From 45bc3007b4da81cc2659673d97b736e770ae7e79 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 16 Jul 2018 12:06:06 +1000 Subject: [PATCH] Add ignore-vanilla-permissions option to assist with disabling default commands By: md_5 --- paper-server/nms-patches/CommandListenerWrapper.patch | 2 +- .../src/main/java/org/bukkit/craftbukkit/CraftServer.java | 3 +++ paper-server/src/main/resources/configurations/commands.yml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/paper-server/nms-patches/CommandListenerWrapper.patch b/paper-server/nms-patches/CommandListenerWrapper.patch index 0f8d1c9d64..bd17f416a7 100644 --- a/paper-server/nms-patches/CommandListenerWrapper.patch +++ b/paper-server/nms-patches/CommandListenerWrapper.patch @@ -26,7 +26,7 @@ public boolean hasPermission(int i) { + // CraftBukkit start + if (currentCommand != null) { -+ return this.f >= i || getBukkitSender().hasPermission(org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand)); ++ return (!getWorld().getServer().ignoreVanillaPermissions && this.f >= i) || getBukkitSender().hasPermission(org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand)); + } + // CraftBukkit end + diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 93886407ec..df6d227fef 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -185,6 +185,7 @@ public final class CraftServer implements Server { private boolean printSaveWarning; private CraftIconCache icon; private boolean overrideAllCommandBlockCommands = false; + public boolean ignoreVanillaPermissions = false; private final List playerView; public int reloadCount; @@ -261,6 +262,7 @@ public final class CraftServer implements Server { saveCommandsConfig(); overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*"); + ignoreVanillaPermissions = commandsConfiguration.getBoolean("ignore-vanilla-permissions"); pluginManager.useTimings(configuration.getBoolean("settings.plugin-profiling")); monsterSpawn = configuration.getInt("spawn-limits.monsters"); animalSpawn = configuration.getInt("spawn-limits.animals"); @@ -741,6 +743,7 @@ public final class CraftServer implements Server { resetRecipes(); reloadData(); overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*"); + ignoreVanillaPermissions = commandsConfiguration.getBoolean("ignore-vanilla-permissions"); int pollCount = 0; diff --git a/paper-server/src/main/resources/configurations/commands.yml b/paper-server/src/main/resources/configurations/commands.yml index 0491a8bbe5..325c67e953 100644 --- a/paper-server/src/main/resources/configurations/commands.yml +++ b/paper-server/src/main/resources/configurations/commands.yml @@ -11,7 +11,7 @@ # Bug tracker: http://www.spigotmc.org/go/bugs command-block-overrides: [] -unrestricted-advancements: false +ignore-vanilla-permissions: false aliases: icanhasbukkit: - "version $1-"