diff --git a/common/src/main/java/org/pokesplash/hunt/util/Utils.java b/common/src/main/java/org/pokesplash/hunt/util/Utils.java index 9a3f28c..b183deb 100644 --- a/common/src/main/java/org/pokesplash/hunt/util/Utils.java +++ b/common/src/main/java/org/pokesplash/hunt/util/Utils.java @@ -309,6 +309,11 @@ public static void removeAllHunts() { } public static void runCommands(ArrayList commands, ServerPlayer player, Pokemon pokemon, double price) { + if (commands == null) { + Hunt.LOGGER.error("Commands are null"); + return; + } + // Run commands CommandDispatcher dispatcher = Hunt.server.getCommands().getDispatcher(); @@ -317,8 +322,9 @@ public static void runCommands(ArrayList commands, ServerPlayer player, dispatcher.execute( Utils.formatPlaceholders(command, player, pokemon, price), Hunt.server.createCommandSourceStack()); - } catch (CommandSyntaxException ex) { - throw new RuntimeException(ex); + } catch (Exception ex) { + Hunt.LOGGER.error("Error running command: " + command); + Hunt.LOGGER.error(ex.getMessage()); } } }