From eb9bc2fdce1317dad47963e077b19209dede2595 Mon Sep 17 00:00:00 2001 From: EnZaXD <60033407+FlorianMichael@users.noreply.github.com> Date: Tue, 24 Oct 2023 05:34:29 +0200 Subject: [PATCH] Remove permission requirements for root command (#3502) --- bukkit/src/main/resources/plugin.yml | 49 ++++--------------- .../bungee/commands/BungeeCommand.java | 2 +- .../commands/ViaCommandHandler.java | 1 - .../sponge/commands/SpongeCommandHandler.java | 2 +- .../command/VelocityCommandHandler.java | 2 +- 5 files changed, 12 insertions(+), 44 deletions(-) diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index 929d2a151..2d536e8c5 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -9,49 +9,18 @@ loadbefore: [ ProtocolLib, ProxyPipe, SpigotLib, SkinRestorer ] softdepend: [ ProtocolSupport, PacketListenerApi ] commands: viaversion: + permission: viaversion.command # The permission is also referenced here to filter root suggestions (/via) description: Shows ViaVersion Version and more. aliases: [ viaver, vvbukkit ] - viaversion autoteam: - permission: viaversion.admin.autoteam - description: Toggle automatically teaming to prevent colliding. - aliases: [ autoteam ] - viaversion debug: - permission: viaversion.admin.debug - description: Toggles various debug modes. - aliases: /viaversion debug [clear/logposttransform/add/remove] - viaversion displayleaks: - permission: viaversion.admin.displayleaks - description: Toggles display of memory leaks. - aliases: [ displayleaks ] - viaversion dontbugme: - permission: viaversion.admin.dontbugme - description: Toggle checking for updates. - aliases: [ dontbugme ] - viaversion dump: - permission: viaversion.admin.dump - description: Dump information about your server, this is helpful if you report bugs. - aliases: [ dump ] - viaversion list: - permission: viaversion.admin.list - description: Lists all players with their protocol version. - aliases: [ list ] - viaversion pps: - permission: viaversion.admin.pps - description: Shows the packets per second of online players. - aliases: [ pps ] - viaversion reload: - permission: viaversion.admin.reload - description: Reloads all config files. - aliases: [ reload ] permissions: viaversion.admin: default: op children: - viaversion.admin.autoteam: true - viaversion.admin.debug: true - viaversion.admin.displayleaks: true - viaversion.admin.dontbugme: true - viaversion.admin.dump: true - viaversion.admin.list: true - viaversion.admin.pps: true - viaversion.admin.reload: true + viaversion.command.autoteam: true + viaversion.command.debug: true + viaversion.command.displayleaks: true + viaversion.command.dontbugme: true + viaversion.command.dump: true + viaversion.command.list: true + viaversion.command.pps: true + viaversion.command.reload: true diff --git a/bungee/src/main/java/com/viaversion/viaversion/bungee/commands/BungeeCommand.java b/bungee/src/main/java/com/viaversion/viaversion/bungee/commands/BungeeCommand.java index 1490d1cb7..c96c34c21 100644 --- a/bungee/src/main/java/com/viaversion/viaversion/bungee/commands/BungeeCommand.java +++ b/bungee/src/main/java/com/viaversion/viaversion/bungee/commands/BungeeCommand.java @@ -25,7 +25,7 @@ public class BungeeCommand extends Command implements TabExecutor { private final BungeeCommandHandler handler; public BungeeCommand(BungeeCommandHandler handler) { - super("viaversion", "viaversion.admin", "viaver", "vvbungee"); // The permission is also referenced here to filter root suggestions (/via) + super("viaversion", "viaversion.command", "viaver", "vvbungee"); // The permission is also referenced here to filter root suggestions (/via) this.handler = handler; } diff --git a/common/src/main/java/com/viaversion/viaversion/commands/ViaCommandHandler.java b/common/src/main/java/com/viaversion/viaversion/commands/ViaCommandHandler.java index bf99042af..670d45306 100644 --- a/common/src/main/java/com/viaversion/viaversion/commands/ViaCommandHandler.java +++ b/common/src/main/java/com/viaversion/viaversion/commands/ViaCommandHandler.java @@ -39,7 +39,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; import static com.viaversion.viaversion.api.command.ViaSubCommand.color; diff --git a/sponge/src/main/java/com/viaversion/viaversion/sponge/commands/SpongeCommandHandler.java b/sponge/src/main/java/com/viaversion/viaversion/sponge/commands/SpongeCommandHandler.java index 7e83c27a7..d6cf5c462 100644 --- a/sponge/src/main/java/com/viaversion/viaversion/sponge/commands/SpongeCommandHandler.java +++ b/sponge/src/main/java/com/viaversion/viaversion/sponge/commands/SpongeCommandHandler.java @@ -46,7 +46,7 @@ public class SpongeCommandHandler extends ViaCommandHandler implements Command.R @Override public boolean canExecute(CommandCause cause) { - return cause.hasPermission("viaversion.admin"); + return cause.hasPermission("viaversion.command"); } @Override diff --git a/velocity/src/main/java/com/viaversion/viaversion/velocity/command/VelocityCommandHandler.java b/velocity/src/main/java/com/viaversion/viaversion/velocity/command/VelocityCommandHandler.java index 6b9a67bd2..673d001c5 100644 --- a/velocity/src/main/java/com/viaversion/viaversion/velocity/command/VelocityCommandHandler.java +++ b/velocity/src/main/java/com/viaversion/viaversion/velocity/command/VelocityCommandHandler.java @@ -43,6 +43,6 @@ public class VelocityCommandHandler extends ViaCommandHandler implements SimpleC @Override public boolean hasPermission(Invocation invocation) { - return invocation.source().hasPermission("viaversion.admin"); // The permission is also referenced here to filter root suggestions (/via) + return invocation.source().hasPermission("viaversion.command"); // The permission is also referenced here to filter root suggestions (/via) } }