diff --git a/Bukkit/src/main/java/me/fixeddev/commandflow/bukkit/BukkitCommandManager.java b/Bukkit/src/main/java/me/fixeddev/commandflow/bukkit/BukkitCommandManager.java index 75528848..c280061c 100644 --- a/Bukkit/src/main/java/me/fixeddev/commandflow/bukkit/BukkitCommandManager.java +++ b/Bukkit/src/main/java/me/fixeddev/commandflow/bukkit/BukkitCommandManager.java @@ -67,20 +67,13 @@ public BukkitCommandManager(CommandManager delegate, String fallbackPrefix) { return true; }); - this.getErrorHandler().addExceptionHandler(InvalidSubCommandException.class, (namespace, ex) -> { - BukkitCommandWrapper.sendMessageToSender(ex, namespace); - - String label = namespace.getObject(String.class, "label"); - - throw new org.bukkit.command.CommandException("An internal parse exception occurred while executing the command " + label, ex); - }); - ErrorHandler.ErrorConsumer commonArgumentExceptionConsumer = (namespace, ex) -> { BukkitCommandWrapper.sendMessageToSender(ex, namespace); return false; }; + this.getErrorHandler().addExceptionHandler(InvalidSubCommandException.class, commonArgumentExceptionConsumer); this.getErrorHandler().addExceptionHandler(ArgumentParseException.class, commonArgumentExceptionConsumer); this.getErrorHandler().addExceptionHandler(NoMoreArgumentsException.class, commonArgumentExceptionConsumer); this.getErrorHandler().addExceptionHandler(NoPermissionsException.class, (namespace, throwable) -> { diff --git a/Bungee/src/main/java/me/fixeddev/commandflow/bungee/BungeeCommandManager.java b/Bungee/src/main/java/me/fixeddev/commandflow/bungee/BungeeCommandManager.java index 7b52b485..463ed6f5 100644 --- a/Bungee/src/main/java/me/fixeddev/commandflow/bungee/BungeeCommandManager.java +++ b/Bungee/src/main/java/me/fixeddev/commandflow/bungee/BungeeCommandManager.java @@ -62,12 +62,6 @@ public BungeeCommandManager(CommandManager commandManager, Plugin plugin) { return false; }); - getErrorHandler().addExceptionHandler(InvalidSubCommandException.class, (namespace, e) -> { - String label = namespace.getObject(String.class, "label"); - BungeeCommandWrapper.sendMessageToSender(e, namespace); - - throw new CommandException("An internal parse exception occurred while executing the command " + label, e); - }); ErrorHandler.ErrorConsumer commonHandler = (namespace, e) -> { BungeeCommandWrapper.sendMessageToSender(e, namespace); @@ -75,6 +69,7 @@ public BungeeCommandManager(CommandManager commandManager, Plugin plugin) { return true; }; + getErrorHandler().addExceptionHandler(InvalidSubCommandException.class, commonHandler); getErrorHandler().addExceptionHandler(ArgumentParseException.class, commonHandler); getErrorHandler().addExceptionHandler(NoMoreArgumentsException.class, commonHandler); getErrorHandler().addExceptionHandler(NoPermissionsException.class, commonHandler); diff --git a/Discord/src/main/java/me/fixeddev/commandflow/discord/DiscordCommandManager.java b/Discord/src/main/java/me/fixeddev/commandflow/discord/DiscordCommandManager.java index b48b2da0..b0067033 100644 --- a/Discord/src/main/java/me/fixeddev/commandflow/discord/DiscordCommandManager.java +++ b/Discord/src/main/java/me/fixeddev/commandflow/discord/DiscordCommandManager.java @@ -57,11 +57,6 @@ public DiscordCommandManager(CommandManager commandManager, JDA client, String c return true; }); - getErrorHandler().addExceptionHandler(InvalidSubCommandException.class, (namespace, e) -> { - MessageListener.sendMessage(namespace, e); - - throw new CommandException("An internal parse exception occurred while executing the command", e); - }); ErrorHandler.ErrorConsumer commonHandler = (namespace, e) -> { MessageListener.sendMessage(namespace, e); @@ -69,6 +64,7 @@ public DiscordCommandManager(CommandManager commandManager, JDA client, String c return true; }; + getErrorHandler().addExceptionHandler(InvalidSubCommandException.class, commonHandler); getErrorHandler().addExceptionHandler(ArgumentParseException.class, commonHandler); getErrorHandler().addExceptionHandler(NoMoreArgumentsException.class, commonHandler); getErrorHandler().addExceptionHandler(NoPermissionsException.class, commonHandler); diff --git a/Velocity/src/main/java/me/fixeddev/commandflow/velocity/VelocityCommandManager.java b/Velocity/src/main/java/me/fixeddev/commandflow/velocity/VelocityCommandManager.java index a588cd88..c2dd1b3d 100644 --- a/Velocity/src/main/java/me/fixeddev/commandflow/velocity/VelocityCommandManager.java +++ b/Velocity/src/main/java/me/fixeddev/commandflow/velocity/VelocityCommandManager.java @@ -64,11 +64,6 @@ public VelocityCommandManager(ProxyServer proxyServer, CommandManager commandMan return true; }); - getErrorHandler().addExceptionHandler(InvalidSubCommandException.class, (namespace, e) -> { - VelocityCommandWrapper.sendMessageToSender(e, namespace); - - throw new CommandException("An internal parse exception occurred while executing the command", e); - }); ErrorHandler.ErrorConsumer commonHandler = (namespace, e) -> { VelocityCommandWrapper.sendMessageToSender(e, namespace); @@ -76,6 +71,7 @@ public VelocityCommandManager(ProxyServer proxyServer, CommandManager commandMan return true; }; + getErrorHandler().addExceptionHandler(InvalidSubCommandException.class, commonHandler); getErrorHandler().addExceptionHandler(ArgumentParseException.class, commonHandler); getErrorHandler().addExceptionHandler(NoMoreArgumentsException.class, commonHandler); getErrorHandler().addExceptionHandler(NoPermissionsException.class, commonHandler);