- Add usage message on argument mismatch where available - Remove unused message keys - Create tool task to search for a message key's usages and to find unused keys
This commit is contained in:
@@ -19,7 +19,7 @@ public interface ExecutableCommand {
|
||||
void executeCommand(CommandSender sender, List<String> arguments);
|
||||
|
||||
/**
|
||||
* Returns the message to show to the user if the command is used with the wrong commands.
|
||||
* Returns the message to show to the user if the command is used with the wrong arguments.
|
||||
* If null is returned, the standard help (/<i>command</i> help) output is shown.
|
||||
*
|
||||
* @return the message explaining the command's usage, or {@code null} for default behavior
|
||||
|
||||
+5
@@ -54,4 +54,9 @@ public class ChangePasswordCommand extends PlayerCommand {
|
||||
protected String getAlternativeCommand() {
|
||||
return "/authme password <playername> <password>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageKey getArgumentsMismatchMessage() {
|
||||
return MessageKey.USAGE_CHANGE_PASSWORD;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,9 @@ public class AddEmailCommand extends PlayerCommand {
|
||||
commonService.send(player, MessageKey.CONFIRM_EMAIL_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageKey getArgumentsMismatchMessage() {
|
||||
return MessageKey.USAGE_ADD_EMAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package fr.xephi.authme.command.executable.email;
|
||||
|
||||
import fr.xephi.authme.command.PlayerCommand;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.process.Management;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -22,4 +23,9 @@ public class ChangeEmailCommand extends PlayerCommand {
|
||||
|
||||
management.performChangeEmail(player, playerMailOld, playerMailNew);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageKey getArgumentsMismatchMessage() {
|
||||
return MessageKey.USAGE_CHANGE_EMAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class RecoverEmailCommand extends PlayerCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerAuth auth = dataSource.getAuth(playerName); // TODO: Create method to get email only
|
||||
PlayerAuth auth = dataSource.getAuth(playerName); // TODO #1127: Create method to get email only
|
||||
if (auth == null) {
|
||||
commonService.send(player, MessageKey.USAGE_REGISTER);
|
||||
return;
|
||||
@@ -73,4 +73,9 @@ public class RecoverEmailCommand extends PlayerCommand {
|
||||
recoveryService.generateAndSendNewPassword(player, email);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageKey getArgumentsMismatchMessage() {
|
||||
return MessageKey.USAGE_RECOVER_EMAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,4 +38,14 @@ public class UnregisterCommand extends PlayerCommand {
|
||||
// Unregister the player
|
||||
management.performUnregister(player, playerPass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageKey getArgumentsMismatchMessage() {
|
||||
return MessageKey.USAGE_UNREGISTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAlternativeCommand() {
|
||||
return "/authme unregister <player>";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user