Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public void UnRegCmd(String command_name) {
- try {
- HashMap<String, Command> known_commands = (HashMap<String, Command>) this.getPrivateField((CommandMap) this.getPrivateField(this.pm, "commandMap"), "knownCommands");
- for (String alias : this.getCommand(command_name).getAliases()) {
- known_commands.remove(command_name);
- }
- known_commands.remove(command_name);
- } catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) {
- this.utils.writeWatchdogExceptionLog(this, this.getClass(), ex);
- }
- }
- private Object getPrivateField(Object object, String field) throws
- SecurityException,
- NoSuchFieldException,
- IllegalArgumentException,
- IllegalAccessException {
- Field objectField = object.getClass().getDeclaredField(field);
- objectField.setAccessible(true);
- return objectField.get(object);
- }
Advertisement
Add Comment
Please, Sign In to add comment