diff --git a/src/main/java/com/sk89q/minecraft/util/commands/CommandsManager.java b/src/main/java/com/sk89q/minecraft/util/commands/CommandsManager.java index 6b7acd161..0c6f3241f 100644 --- a/src/main/java/com/sk89q/minecraft/util/commands/CommandsManager.java +++ b/src/main/java/com/sk89q/minecraft/util/commands/CommandsManager.java @@ -398,19 +398,23 @@ public abstract class CommandsManager { Object instance = instances.get(method); - try { - method.invoke(instance, methodArgs); - } catch (IllegalArgumentException e) { - logger.log(Level.SEVERE, "Failed to execute command", e); - } catch (IllegalAccessException e) { - logger.log(Level.SEVERE, "Failed to execute command", e); - } catch (InvocationTargetException e) { - if (e.getCause() instanceof CommandException) { - throw (CommandException) e.getCause(); - } - - throw new WrappedCommandException(e.getCause()); + invokeMethod(parent, args, player, method, instance, methodArgs, argsCount); + } + } + + public void invokeMethod(Method parent, String[] args, T player, Method method, Object instance, Object[] methodArgs, int level) throws CommandException { + try { + method.invoke(instance, methodArgs); + } catch (IllegalArgumentException e) { + logger.log(Level.SEVERE, "Failed to execute command", e); + } catch (IllegalAccessException e) { + logger.log(Level.SEVERE, "Failed to execute command", e); + } catch (InvocationTargetException e) { + if (e.getCause() instanceof CommandException) { + throw (CommandException) e.getCause(); } + + throw new WrappedCommandException(e.getCause()); } }