Refactorings - prepare to remove FoundCommandResult

- Reduce tight coupling by passing list of available commands as param to CommandHandler
- Split command processing method into several smaller ones
- Remove unfinished logic for unlimited command arguments (reason: was not implemented and not used, probably needs another way to handle it once the need for it arises)
- Create test for CommandHandler
This commit is contained in:
ljacqu
2015-12-04 21:33:50 +01:00
parent 0c1589f93a
commit c78e12de04
9 changed files with 223 additions and 173 deletions
@@ -5,7 +5,6 @@ import fr.xephi.authme.command.CommandArgumentDescription;
import fr.xephi.authme.command.CommandDescription;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.CommandPermissions;
import fr.xephi.authme.command.CommandUtils;
import fr.xephi.authme.permission.PermissionNode;
import fr.xephi.authme.util.StringUtils;
import org.bukkit.ChatColor;
@@ -77,10 +76,6 @@ public class HelpPrinter {
// Print the syntax
sender.sendMessage(argString.toString());
}
// Show the unlimited arguments argument
if (!command.hasMaximumArguments())
sender.sendMessage(" " + ChatColor.YELLOW + ChatColor.ITALIC + "... : " + ChatColor.WHITE + "Any additional arguments." + ChatColor.GRAY + ChatColor.ITALIC + " (Optional)");
}
/**
@@ -61,11 +61,6 @@ public final class HelpSyntaxHelper {
sb.append(ChatColor.ITALIC).append(formatArgument(arg));
}
// Add some dots if the command allows unlimited arguments
if (!commandDescription.hasMaximumArguments()) {
sb.append(ChatColor.ITALIC).append(" ...");
}
// Return the build command syntax
return sb.toString();
}