#305 Adjust behavior of label handling; cleanup
- Fix bugs in behavior (wrong labels being shown for help) - Change order of labels and arguments in FoundCommandResult constructors - Move FoundResultStatus enum to its own class - Create test class for HelpProvider
This commit is contained in:
@@ -5,6 +5,7 @@ import fr.xephi.authme.command.CommandHandler;
|
||||
import fr.xephi.authme.command.CommandUtils;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.command.FoundCommandResult;
|
||||
import fr.xephi.authme.command.FoundResultStatus;
|
||||
import fr.xephi.authme.command.help.HelpProvider;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -12,7 +13,9 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static fr.xephi.authme.command.FoundCommandResult.ResultStatus.*;
|
||||
import static fr.xephi.authme.command.FoundResultStatus.INCORRECT_ARGUMENTS;
|
||||
import static fr.xephi.authme.command.FoundResultStatus.MISSING_BASE_COMMAND;
|
||||
import static fr.xephi.authme.command.FoundResultStatus.UNKNOWN_LABEL;
|
||||
|
||||
public class HelpCommand extends ExecutableCommand {
|
||||
|
||||
@@ -27,8 +30,9 @@ public class HelpCommand extends ExecutableCommand {
|
||||
// TODO ljacqu 20151213: This is essentially the same logic as in CommandHandler and we'd like to have the same
|
||||
// messages. Maybe we can have another method in CommandHandler where the end command isn't executed upon
|
||||
// success.
|
||||
FoundCommandResult.ResultStatus resultStatus = foundCommandResult.getResultStatus();
|
||||
FoundResultStatus resultStatus = foundCommandResult.getResultStatus();
|
||||
if (MISSING_BASE_COMMAND.equals(resultStatus)) {
|
||||
// FIXME something wrong - this error appears
|
||||
sender.sendMessage(ChatColor.DARK_RED + "Could not get base command");
|
||||
return;
|
||||
} else if (INCORRECT_ARGUMENTS.equals(resultStatus) || UNKNOWN_LABEL.equals(resultStatus)) {
|
||||
|
||||
Reference in New Issue
Block a user