From 74540332771882b9c02f13f5dd1b296d7c04b345 Mon Sep 17 00:00:00 2001 From: Jens Collaert <63231928+Jens-Co@users.noreply.github.com> Date: Wed, 13 Oct 2021 19:09:19 +0200 Subject: [PATCH] Register `/geyser stop` only on standalone (#2569) We don't want to condone stopping Geyser in the middle of a plugin session, especially when there's no way to start it back up again. --- bootstrap/spigot/src/main/resources/plugin.yml | 2 -- .../java/org/geysermc/connector/command/CommandManager.java | 5 ++++- .../org/geysermc/connector/command/defaults/StopCommand.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bootstrap/spigot/src/main/resources/plugin.yml b/bootstrap/spigot/src/main/resources/plugin.yml index 0cd78ebe3..0171abd70 100644 --- a/bootstrap/spigot/src/main/resources/plugin.yml +++ b/bootstrap/spigot/src/main/resources/plugin.yml @@ -22,8 +22,6 @@ permissions: description: Puts an items in your offhand. geyser.command.reload: description: Reloads the Geyser configurations. Kicks all players when used! - geyser.command.shutdown: - description: Shuts down Geyser. geyser.command.statistics: description: Shows the statistics of the player on the server. geyser.command.version: diff --git a/connector/src/main/java/org/geysermc/connector/command/CommandManager.java b/connector/src/main/java/org/geysermc/connector/command/CommandManager.java index f62fd8539..53cdfb269 100644 --- a/connector/src/main/java/org/geysermc/connector/command/CommandManager.java +++ b/connector/src/main/java/org/geysermc/connector/command/CommandManager.java @@ -27,6 +27,7 @@ package org.geysermc.connector.command; import lombok.Getter; +import org.geysermc.common.PlatformType; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.command.defaults.*; import org.geysermc.connector.network.session.GeyserSession; @@ -47,13 +48,15 @@ public abstract class CommandManager { registerCommand(new HelpCommand(connector, "help", "geyser.commands.help.desc", "geyser.command.help")); registerCommand(new ListCommand(connector, "list", "geyser.commands.list.desc", "geyser.command.list")); registerCommand(new ReloadCommand(connector, "reload", "geyser.commands.reload.desc", "geyser.command.reload")); - registerCommand(new StopCommand(connector, "stop", "geyser.commands.stop.desc", "geyser.command.stop")); registerCommand(new OffhandCommand(connector, "offhand", "geyser.commands.offhand.desc", "geyser.command.offhand")); registerCommand(new DumpCommand(connector, "dump", "geyser.commands.dump.desc", "geyser.command.dump")); registerCommand(new VersionCommand(connector, "version", "geyser.commands.version.desc", "geyser.command.version")); registerCommand(new SettingsCommand(connector, "settings", "geyser.commands.settings.desc", "geyser.command.settings")); registerCommand(new StatisticsCommand(connector, "statistics", "geyser.commands.statistics.desc", "geyser.command.statistics")); registerCommand(new AdvancementsCommand("advancements", "geyser.commands.advancements.desc", "geyser.command.advancements")); + if (GeyserConnector.getInstance().getPlatformType() == PlatformType.STANDALONE) { + registerCommand(new StopCommand(connector, "stop", "geyser.commands.stop.desc", "geyser.command.stop")); + } } public void registerCommand(GeyserCommand command) { diff --git a/connector/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java b/connector/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java index 8ceeb9990..ad5049432 100644 --- a/connector/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java +++ b/connector/src/main/java/org/geysermc/connector/command/defaults/StopCommand.java @@ -54,4 +54,4 @@ public class StopCommand extends GeyserCommand { connector.getBootstrap().onDisable(); } -} +} \ No newline at end of file