@Override public boolean onCommand(CommandSender cs, Command command, String label, String[] args) { try { commandsManager.executeCommand(command, cs, args); commandLog(command, cs, args, true); } catch (CommandException ex) { String report = "&c" + ex.getMessage(); for (String str : Formatter.selectFormatter(SimpleFormatter.class).format(report, null)) { cs.sendMessage(str); } if (ex instanceof CommandMethodInvocationException || ex instanceof MalformattedCommandException) { log(ex.getMessage(), 2); ex.printStackTrace(); return true; } else if (ex instanceof ArgumentOutOfBoundsException) { try { commandsManager.sendHelp(cs, command); } catch (MalformattedCommandException ex1) { String _report = "&c" + ex1.getMessage(); for (String str : Formatter.selectFormatter(SimpleFormatter.class).format(_report, null)) { cs.sendMessage(str); } log(ex.getMessage(), 2); ex.printStackTrace(); return true; } } commandLog(command, cs, args, false); } catch (InsufficientPermissionsException ex) { String report = "&c" + ex.getMessage(); for (String str : Formatter.selectFormatter(SimpleFormatter.class).format(report, null)) { cs.sendMessage(str); } commandLog(command, cs, args, false); } return true; }
@Override public void onEnable() { instance = this; perms = new PermissionsManager(this.getServer(), "[VoxelGuest]", config); groupManager = new GroupManager(); moduleManager = new ModuleManager(this, commandsManager); registerPluginIds(); // Register system / miscellaneous commands commandsManager.registerCommands(MiscellaneousCommands.class); commandsManager.registerCommands(ServerAdministrationCommands.class); // Load system event listeners Bukkit.getPluginManager().registerEvents(listener, this); Bukkit.getPluginManager().registerEvents(perms, this); // Load permissions system perms.registerActiveHandler(); // Load players for (Player player : Bukkit.getOnlinePlayers()) { GuestPlayer gp = new GuestPlayer(player); if (isPlayerRegistered(gp)) { continue; } groupManager.verifyPlayerGroupExistence(player); guestPlayers.add(gp); // KEEP THIS LAST ONLINE_MEMBERS++; } // Load modules ModuleManager.setActiveModuleManager(moduleManager); moduleManager.loadModules(availableModules); // Load module events into the system listener listener.registerModuleEvents(); if (getConfigData().getString("reset") == null || getConfigData().getString("reset").equalsIgnoreCase("yes")) { loadFactorySettings(); } }