/** * Gets a registered command under the given subcommand name. * * @param subcommand * The name of the subcommand requested. * * @return The subcommand found or null if none. */ private RegisteredCommand getCommandBySubcommand(String subcommand) { return getCommandBySubcommand(subcommand, false); }
public RegisteredCommand getDefaultRegisteredCommand() { return this.getCommandBySubcommand(DEFAULT); }
/** * Internally calls {@link #executeCommand(CommandOperationContext, CommandIssuer, String[], RegisteredCommand)} * and gets through {@link #getCommandBySubcommand(String)}. * * @param commandContext * The command context to use. * @param subcommand * The subcommand to find the executor of. * @param issuer * The issuer who executed the subcommand. * @param args * All arguments given by the issuer. * * @return Whether it found a command or not. * * @see #executeCommand(CommandOperationContext, CommandIssuer, String[], RegisteredCommand) * @see #getCommandBySubcommand(String) * @see RegisteredCommand#invoke(CommandIssuer, List, CommandOperationContext) */ private boolean findAndExecuteCommand(CommandOperationContext commandContext, String subcommand, CommandIssuer issuer, String... args) { final RegisteredCommand cmd = this.getCommandBySubcommand(subcommand); if (cmd != null) { executeCommand(commandContext, issuer, args, cmd); return true; } return false; }