Skip to content

Commit

Permalink
Fix a random bug with paper servers
Browse files Browse the repository at this point in the history
  • Loading branch information
CoPokBl committed Aug 24, 2024
1 parent 11812af commit 04a668d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 04a668d

Please sign in to comment.