mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-30 14:13:35 +01:00
Implemented getemail command
Various other improvements.
This commit is contained in:
parent
89c3c6ed5b
commit
19f4af3e85
@ -164,6 +164,21 @@ public class CommandManager {
|
||||
accountsCommand.setCommandPermissions("authme.admin.accounts", CommandPermissions.DefaultPermission.OP_ONLY);
|
||||
accountsCommand.addArgument(new CommandArgumentDescription("player", "Player name or IP", true));
|
||||
|
||||
// Register the getemail command
|
||||
CommandDescription getEmailCommand = new CommandDescription(
|
||||
new RegisterCommand(),
|
||||
new ArrayList<String>() {{
|
||||
add("getemail");
|
||||
add("getmail");
|
||||
add("email");
|
||||
add("mail");
|
||||
}},
|
||||
"Display player's email",
|
||||
"Display the email address of the specified player if set.",
|
||||
authMeCommand);
|
||||
getEmailCommand.setCommandPermissions("authme.admin.getemail", CommandPermissions.DefaultPermission.OP_ONLY);
|
||||
getEmailCommand.addArgument(new CommandArgumentDescription("player", "Player name", true));
|
||||
|
||||
// Register the purge command
|
||||
CommandDescription purgeCommand = new CommandDescription(
|
||||
new PurgeCommand(),
|
||||
|
@ -25,6 +25,7 @@ public class AccountsCommand extends ExecutableCommand {
|
||||
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
final Messages m = Messages.getInstance();
|
||||
|
||||
|
@ -0,0 +1,45 @@
|
||||
package fr.xephi.authme.command.executable.authme;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class GetEmailCommand extends ExecutableCommand {
|
||||
|
||||
/**
|
||||
* Execute the command.
|
||||
*
|
||||
* @param sender The command sender.
|
||||
* @param commandReference The command reference.
|
||||
* @param commandArguments The command arguments.
|
||||
*
|
||||
* @return True if the command was executed successfully, false otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
Messages m = Messages.getInstance();
|
||||
|
||||
// Get the player name
|
||||
String playerName = sender.getName();
|
||||
if(commandArguments.getCount() >= 1)
|
||||
playerName = commandArguments.get(0);
|
||||
|
||||
// Get the authenticated user
|
||||
PlayerAuth auth = plugin.database.getAuth(playerName.toLowerCase());
|
||||
if (auth == null) {
|
||||
m.send(sender, "unknown_user");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Show the email address
|
||||
sender.sendMessage("[AuthMe] " + playerName + "'s email: " + auth.getEmail());
|
||||
return true;
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@ public class LastLoginCommand extends ExecutableCommand {
|
||||
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
Messages m = Messages.getInstance();
|
||||
|
||||
|
@ -28,6 +28,7 @@ public class RegisterCommand extends ExecutableCommand {
|
||||
public boolean executeCommand(final CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
|
||||
// AuthMe plugin instance
|
||||
final AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
final Messages m = Messages.getInstance();
|
||||
|
||||
|
@ -29,6 +29,7 @@ public class ReloadCommand extends ExecutableCommand {
|
||||
|
||||
// AuthMe plugin instance
|
||||
AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
// Messages instance
|
||||
Messages m = Messages.getInstance();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user