Implemented the base of the resetname command
This commit is contained in:
parent
b4d710840d
commit
913ba56343
@ -286,6 +286,18 @@ public class CommandManager {
|
|||||||
switchAntiBotCommand.setCommandPermissions("authme.admin.switchantibot", CommandPermissions.DefaultPermission.OP_ONLY);
|
switchAntiBotCommand.setCommandPermissions("authme.admin.switchantibot", CommandPermissions.DefaultPermission.OP_ONLY);
|
||||||
switchAntiBotCommand.addArgument(new CommandArgumentDescription("mode", "ON / OFF", true));
|
switchAntiBotCommand.addArgument(new CommandArgumentDescription("mode", "ON / OFF", true));
|
||||||
|
|
||||||
|
// // Register the resetname command
|
||||||
|
// CommandDescription resetNameCommand = new CommandDescription(
|
||||||
|
// new SwitchAntiBotCommand(),
|
||||||
|
// new ArrayList<String>() {{
|
||||||
|
// add("resetname");
|
||||||
|
// add("resetnames");
|
||||||
|
// }},
|
||||||
|
// "Reset name",
|
||||||
|
// "Reset name",
|
||||||
|
// authMeCommand);
|
||||||
|
// resetNameCommand.setCommandPermissions("authme.admin.resetname", CommandPermissions.DefaultPermission.OP_ONLY);
|
||||||
|
|
||||||
// Register the reload command
|
// Register the reload command
|
||||||
CommandDescription reloadCommand = new CommandDescription(
|
CommandDescription reloadCommand = new CommandDescription(
|
||||||
new ReloadCommand(),
|
new ReloadCommand(),
|
||||||
|
|||||||
@ -0,0 +1,42 @@
|
|||||||
|
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 org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ResetNameCommand 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
|
||||||
|
final AuthMe plugin = AuthMe.getInstance();
|
||||||
|
|
||||||
|
// Command logic
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
List<PlayerAuth> authentications = plugin.database.getAllAuths();
|
||||||
|
for(PlayerAuth auth : authentications) {
|
||||||
|
auth.setRealName("Player");
|
||||||
|
plugin.database.updateSession(auth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user