From 9507926e73471cdef3d494e9fbfe84753158271a Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Thu, 24 Aug 2023 17:55:54 +0200 Subject: [PATCH 1/3] Fix duplicate permission registration --- .../geyser/platform/spigot/GeyserSpigotPlugin.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java index 16ee13c8202..b932962a043 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java @@ -165,13 +165,6 @@ public void onEnable() { return; } - // Remove this in like a year - if (Bukkit.getPluginManager().getPlugin("floodgate-bukkit") != null) { - geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.outdated", Constants.FLOODGATE_DOWNLOAD_LOCATION)); - this.getPluginLoader().disablePlugin(this); - return; - } - this.geyserCommandManager = new GeyserSpigotCommandManager(geyser); this.geyserCommandManager.init(); @@ -323,6 +316,12 @@ private void postStartup() { continue; } + // Avoid registering the same permission twice, e.g. for the extension help commands + if (Bukkit.getPluginManager().getPermission(command.permission()) != null) { + GeyserImpl.getInstance().getLogger().debug("Skipping permission " + command.permission() + " as it is already registered"); + continue; + } + Bukkit.getPluginManager().addPermission(new Permission(command.permission(), GeyserLocale.getLocaleStringLog(command.description()), command.isSuggestedOpOnly() ? PermissionDefault.OP : PermissionDefault.TRUE)); From d3099b4eeb1d1c6f04086e3bdff197f06f82c606 Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Thu, 24 Aug 2023 18:35:04 +0200 Subject: [PATCH 2/3] Register / help (and aliased ?) commands under the "geyser.command.exthelp.id" permission --- .../java/org/geysermc/geyser/command/GeyserCommandManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/command/GeyserCommandManager.java b/core/src/main/java/org/geysermc/geyser/command/GeyserCommandManager.java index 483e8d4a72f..373395ea270 100644 --- a/core/src/main/java/org/geysermc/geyser/command/GeyserCommandManager.java +++ b/core/src/main/java/org/geysermc/geyser/command/GeyserCommandManager.java @@ -107,7 +107,8 @@ public void register(@NonNull Command command) { // Register help commands for all extensions with commands for (Map.Entry> entry : this.extensionCommands.entrySet()) { - registerExtensionCommand(entry.getKey(), new HelpCommand(this.geyser, "help", "geyser.commands.exthelp.desc", "geyser.command.exthelp", entry.getKey().description().id(), entry.getValue())); + String id = entry.getKey().description().id(); + registerExtensionCommand(entry.getKey(), new HelpCommand(this.geyser, "help", "geyser.commands.exthelp.desc", "geyser.command.exthelp." + id, id, entry.getValue())); } } From f272a121eaf49730f278360110b15c297d4200ee Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Thu, 24 Aug 2023 19:00:53 +0200 Subject: [PATCH 3/3] Fix: Show correct header for /geyser help vs / help --- .../java/org/geysermc/geyser/command/defaults/HelpCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java index d4ec7d16144..c9671b08952 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java @@ -63,7 +63,8 @@ public HelpCommand(GeyserImpl geyser, String name, String description, String pe public void execute(GeyserSession session, GeyserCommandSource sender, String[] args) { int page = 1; int maxPage = 1; - String header = GeyserLocale.getPlayerLocaleString("geyser.commands.help.header", sender.locale(), page, maxPage); + String translationKey = this.baseCommand.equals("geyser") ? "geyser.commands.help.header" : "geyser.commands.extensions.header"; + String header = GeyserLocale.getPlayerLocaleString(translationKey, sender.locale(), page, maxPage); sender.sendMessage(header); this.commands.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEach(entry -> {