- Add default method to ExecutableCommand interface that allows to define the message key to show if a command's arguments are invalid. If not defined the behavior is as before: show the output of /<command> help - Use translatable "no permission" message instead of hardcoded one
This commit is contained in:
+5
@@ -49,4 +49,9 @@ public class ChangePasswordCommand extends PlayerCommand {
|
||||
|
||||
management.performPasswordChange(player, oldPassword, newPassword);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAlternativeCommand() {
|
||||
return "/authme password <playername> <password>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package fr.xephi.authme.command.executable.login;
|
||||
|
||||
import fr.xephi.authme.command.PlayerCommand;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.process.Management;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -20,4 +21,14 @@ public class LoginCommand extends PlayerCommand {
|
||||
final String password = arguments.get(0);
|
||||
management.performLogin(player, password);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageKey getArgumentsMismatchMessage() {
|
||||
return MessageKey.USAGE_LOGIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAlternativeCommand() {
|
||||
return "/authme forcelogin <player>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,11 @@ public class RegisterCommand extends PlayerCommand {
|
||||
return "/authme register <playername> <password>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageKey getArgumentsMismatchMessage() {
|
||||
return MessageKey.USAGE_LOGIN;
|
||||
}
|
||||
|
||||
private void handlePasswordRegistration(Player player, List<String> arguments) {
|
||||
if (isSecondArgValidForPasswordRegistration(player, arguments)) {
|
||||
final String password = arguments.get(0);
|
||||
|
||||
Reference in New Issue
Block a user