throw ex; } catch (Throwable ex) { throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex);
private void handleCommand(ChannelHandlerContext ctx, String payload, int requestId) { if (!loggedIn) { sendResponse(ctx, FAILURE, TYPE_COMMAND, ""); return; } try { RemoteServerCommandEvent event = EventFactory.getInstance() .callEvent(new RemoteServerCommandEvent(commandSender, payload)); if (event.isCancelled()) { return; } rconServer.getServer().dispatchCommand(commandSender, event.getCommand()); String message = commandSender.flush(); if (!rconServer.getServer().useRconColors()) { message = ChatColor.stripColor(message); } sendLargeResponse(ctx, requestId, message); } catch (CommandException e) { sendLargeResponse(ctx, requestId, String.format("Error executing: %s (%s)", payload, e.getMessage())); } }
plugin.saveConfig(); } catch (CommandException e) { plugin.getServer().getLogger().log(Level.SEVERE, "Could not copy Gallifrey files to " + which + " plugin data folder: {0}", e.getMessage());
throw new CommandException(message.toString(), ex);
plugin.saveConfig(); } catch (CommandException e) { plugin.getServer().getLogger().log(Level.SEVERE, "Could not copy Siluria files to " + which + " plugin data folder: {0}", e.getMessage());
/** * {@inheritDoc} */ public boolean dispatch(CommandSender sender, String commandLine) throws CommandException { String[] args = PATTERN_ON_SPACE.split(commandLine); if (args.length == 0) { return false; } String sentCommandLabel = args[0].toLowerCase(); Command target = getCommand(sentCommandLabel); if (target == null) { return false; } try { // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false) target.execute(sender, sentCommandLabel, Arrays_copyOfRange(args, 1, args.length)); } catch (CommandException ex) { throw ex; } catch (Throwable ex) { throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex); } // return true as command was handled return true; }
plugin.debug(e.getMessage());
/** * 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; }
plugin.getServer().getLogger().log(Level.SEVERE, "Could not copy Skaro files to " + which + " plugin data folder: {0}", e.getMessage());
throw ex; } catch (Throwable ex) { throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex);
throw new CommandException(message.toString(), ex);
/** * 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; }
/** * {@inheritDoc} */ public boolean dispatch(CommandSender sender, String commandLine) throws CommandException { String[] args = PATTERN_ON_SPACE.split(commandLine); if (args.length == 0) { return false; } String sentCommandLabel = args[0].toLowerCase(); Command target = getCommand(sentCommandLabel); if (target == null) { return false; } try { target.timings.startTiming(); // Spigot // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false) target.execute(sender, sentCommandLabel, Arrays_copyOfRange(args, 1, args.length)); target.timings.stopTiming(); // Spigot } catch (CommandException ex) { target.timings.stopTiming(); // Spigot throw ex; } catch (Throwable ex) { target.timings.stopTiming(); // Spigot throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex); } // return true as command was handled return true; }
String mgmName = args[0]; if(MinigameUtils.sanitizeYamlString(mgmName) == null) { throw new CommandException("Name is not valid for use in a Config.");