mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-26 18:47:37 +01:00
run task async, fix #200
This commit is contained in:
parent
5a9c6278b6
commit
90c7187bab
@ -25,8 +25,8 @@ public class ChangePasswordCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmnd, String label,
|
||||
String[] args) {
|
||||
public boolean onCommand(final CommandSender sender, Command cmnd, String label,
|
||||
final String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return true;
|
||||
}
|
||||
@ -36,8 +36,8 @@ public class ChangePasswordCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
String name = player.getName().toLowerCase();
|
||||
final Player player = (Player) sender;
|
||||
final String name = player.getName().toLowerCase();
|
||||
if (!PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
m.send(player, "not_logged_in");
|
||||
return true;
|
||||
@ -67,6 +67,9 @@ public class ChangePasswordCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, args[1], name);
|
||||
|
||||
@ -78,7 +81,7 @@ public class ChangePasswordCommand implements CommandExecutor {
|
||||
else auth.setSalt("");
|
||||
if (!plugin.database.updatePassword(auth)) {
|
||||
m.send(player, "error");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
plugin.database.updateSalt(auth);
|
||||
PlayerCache.getInstance().updatePlayer(auth);
|
||||
@ -91,6 +94,8 @@ public class ChangePasswordCommand implements CommandExecutor {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
m.send(sender, "error");
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user