mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-24 10:17:39 +00:00
Added an invokeMethod hook to CommandsManager, that wraps method invocation and can be overridden
This commit is contained in:
parent
96eb94155c
commit
2c155c241b
@ -398,6 +398,11 @@ public abstract class CommandsManager<T> {
|
|||||||
|
|
||||||
Object instance = instances.get(method);
|
Object instance = instances.get(method);
|
||||||
|
|
||||||
|
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 {
|
try {
|
||||||
method.invoke(instance, methodArgs);
|
method.invoke(instance, methodArgs);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
@ -412,7 +417,6 @@ public abstract class CommandsManager<T> {
|
|||||||
throw new WrappedCommandException(e.getCause());
|
throw new WrappedCommandException(e.getCause());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether a player has access to a command.
|
* Returns whether a player has access to a command.
|
||||||
|
Loading…
Reference in New Issue
Block a user