Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 19:10:07 +01:00
Added an invokeMethod hook to CommandsManager, that wraps method invocation and can be overridden
Dieser Commit ist enthalten in:
Ursprung
96eb94155c
Commit
2c155c241b
@ -398,19 +398,23 @@ public abstract class CommandsManager<T> {
|
|||||||
|
|
||||||
Object instance = instances.get(method);
|
Object instance = instances.get(method);
|
||||||
|
|
||||||
try {
|
invokeMethod(parent, args, player, method, instance, methodArgs, argsCount);
|
||||||
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());
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren