diff --git a/src/main/java/net/estools/ServerApi/Implementations/Bukkit/BukkitServer.java b/src/main/java/net/estools/ServerApi/Implementations/Bukkit/BukkitServer.java index b569cb3..88d75e1 100644 --- a/src/main/java/net/estools/ServerApi/Implementations/Bukkit/BukkitServer.java +++ b/src/main/java/net/estools/ServerApi/Implementations/Bukkit/BukkitServer.java @@ -325,7 +325,14 @@ public void startEvents() { @Override public void registerCommand(String cmd, EsToolsTabCompleter tab) { - PluginCommand command = Objects.requireNonNull(Bukkit.getPluginCommand(cmd)); + PluginCommand command = Bukkit.getPluginCommand(cmd); + + if (command == null) { + Main.logger.severe("Could not register command: " + cmd + ", the server didn't let us"); + Main.logger.severe("We think this is an issue with PaperMC, consider using Spigot"); + return; + } + if (!Main.tabCompleteEnabled || command.getTabCompleter() == null) { command.setExecutor(cmdExecutor); } diff --git a/src/main/java/net/estools/ServerApi/Implementations/Folia/FoliaServer.java b/src/main/java/net/estools/ServerApi/Implementations/Folia/FoliaServer.java index 6c7546b..906b468 100644 --- a/src/main/java/net/estools/ServerApi/Implementations/Folia/FoliaServer.java +++ b/src/main/java/net/estools/ServerApi/Implementations/Folia/FoliaServer.java @@ -306,7 +306,14 @@ public void startEvents() { @Override public void registerCommand(String cmd, EsToolsTabCompleter tab) { - PluginCommand command = Objects.requireNonNull(Bukkit.getPluginCommand(cmd)); + PluginCommand command = Bukkit.getPluginCommand(cmd); + + if (command == null) { + Main.logger.severe("Could not register command: " + cmd + ", the server didn't let us"); + Main.logger.severe("We think this is an issue with PaperMC so Folia probably inherited it"); + return; + } + command.setExecutor(listener); if (Main.tabCompleteEnabled) { command.setTabCompleter(BukkitTabCompleteGenerator.generate(tab));