/** * Executes the command, returning its success * * @param sender Source object which is executing this command * @param commandLabel The alias of the command used * @param args All arguments passed to the command, split via ' ' * @return true if the command was successful, otherwise false */ @Override public boolean execute(CommandSender sender, String commandLabel, String[] args) { boolean success = false; if (!owningPlugin.isEnabled()) { return false; } if (!testPermission(sender)) { return true; } try { success = executor.onCommand(sender, this, commandLabel, args); } catch (Throwable ex) { throw new CommandException("Unhandled exception executing command '" + commandLabel + "' in plugin " + owningPlugin.getDescription().getFullName(), ex); } if (!success && usageMessage.length() > 0) { for (String line : usageMessage.replace("<command>", commandLabel).split("\n")) { sender.sendMessage(line); } } return success; }
/** * Executes the command, returning its success * * @param sender Source object which is executing this command * @param commandLabel The alias of the command used * @param args All arguments passed to the command, split via ' ' * @return true if the command was successful, otherwise false */ @Override public boolean execute(CommandSender sender, String commandLabel, String[] args) { boolean success = false; if (!owningPlugin.isEnabled()) { return false; } if (!testPermission(sender)) { return true; } try { success = executor.onCommand(sender, this, commandLabel, args); } catch (Throwable ex) { throw new CommandException("Unhandled exception executing command '" + commandLabel + "' in plugin " + owningPlugin.getDescription().getFullName(), ex); } if (!success && usageMessage.length() > 0) { for (String line : usageMessage.replace("<command>", commandLabel).split("\n")) { sender.sendMessage(line); } } return success; }