aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/elytrium/limboauth/command
diff options
context:
space:
mode:
authormdxd44 <ogurec332@mail.ru>2021-12-23 12:15:10 +0900
committermdxd44 <ogurec332@mail.ru>2021-12-23 12:15:10 +0900
commit5fe79b92327c082384068fa45c3b1d2691800e3d (patch)
treeae8ab7382d969baa807da7d94c2a81bff8ba0405 /src/main/java/net/elytrium/limboauth/command
parentcff1b4a22bb47c8bcf064d5e8da8c7d7ef67ea52 (diff)
downloadLimboAuth-5fe79b92327c082384068fa45c3b1d2691800e3d.tar.gz
LimboAuth-5fe79b92327c082384068fa45c3b1d2691800e3d.tar.bz2
LimboAuth-5fe79b92327c082384068fa45c3b1d2691800e3d.zip
Titles, auth time, bossbar, max and min auth time, unsafe passwords. (Closes LimboAPI#8)
Diffstat (limited to 'src/main/java/net/elytrium/limboauth/command')
-rw-r--r--src/main/java/net/elytrium/limboauth/command/DestroySessionCommand.java2
-rw-r--r--src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java8
-rw-r--r--src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java7
3 files changed, 9 insertions, 8 deletions
diff --git a/src/main/java/net/elytrium/limboauth/command/DestroySessionCommand.java b/src/main/java/net/elytrium/limboauth/command/DestroySessionCommand.java
index 27dff72..b0e6cf4 100644
--- a/src/main/java/net/elytrium/limboauth/command/DestroySessionCommand.java
+++ b/src/main/java/net/elytrium/limboauth/command/DestroySessionCommand.java
@@ -49,7 +49,7 @@ public class DestroySessionCommand implements SimpleCommand {
return;
}
- this.plugin.removePlayerFromCache((Player) source);
+ this.plugin.removePlayerFromCache(((Player) source).getUsername());
source.sendMessage(this.successful);
}
diff --git a/src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java b/src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java
index d45eae9..2b97143 100644
--- a/src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java
+++ b/src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java
@@ -40,7 +40,7 @@ public class ForceUnregisterCommand implements SimpleCommand {
private final ProxyServer server;
private final Dao<RegisteredPlayer, String> playerDao;
- private final Component successfulPlayer;
+ private final Component kick;
private final String successful;
private final String notSuccessful;
private final Component usage;
@@ -50,7 +50,7 @@ public class ForceUnregisterCommand implements SimpleCommand {
this.server = server;
this.playerDao = playerDao;
- this.successfulPlayer = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.FORCE_UNREGISTER_SUCCESSFUL_PLAYER);
+ this.kick = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.FORCE_UNREGISTER_KICK);
this.successful = Settings.IMP.MAIN.STRINGS.FORCE_UNREGISTER_SUCCESSFUL;
this.notSuccessful = Settings.IMP.MAIN.STRINGS.FORCE_UNREGISTER_NOT_SUCCESSFUL;
this.usage = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.FORCE_UNREGISTER_USAGE);
@@ -83,9 +83,9 @@ public class ForceUnregisterCommand implements SimpleCommand {
String playerNick = args[0];
try {
this.playerDao.deleteById(playerNick.toLowerCase(Locale.ROOT));
+ this.plugin.removePlayerFromCache(playerNick);
this.server.getPlayer(playerNick).ifPresent(player -> {
- this.plugin.removePlayerFromCache(player);
- player.disconnect(this.successfulPlayer);
+ player.disconnect(this.kick);
});
source.sendMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(MessageFormat.format(this.successful, playerNick)));
} catch (SQLException e) {
diff --git a/src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java b/src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java
index aeab6ec..5fe8643 100644
--- a/src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java
+++ b/src/main/java/net/elytrium/limboauth/command/UnregisterCommand.java
@@ -67,13 +67,14 @@ public class UnregisterCommand implements SimpleCommand {
if (args.length == 2) {
if (args[1].equalsIgnoreCase("confirm")) {
- RegisteredPlayer player = AuthSessionHandler.fetchInfo(this.playerDao, ((Player) source).getUsername());
+ String username = ((Player) source).getUsername();
+ RegisteredPlayer player = AuthSessionHandler.fetchInfo(this.playerDao, username);
if (player == null) {
source.sendMessage(this.notRegistered);
} else if (AuthSessionHandler.checkPassword(args[0], player, this.playerDao)) {
try {
- this.playerDao.deleteById(((Player) source).getUsername().toLowerCase(Locale.ROOT));
- this.plugin.removePlayerFromCache((Player) source);
+ this.playerDao.deleteById(username.toLowerCase(Locale.ROOT));
+ this.plugin.removePlayerFromCache(username);
((Player) source).disconnect(this.successful);
} catch (SQLException e) {
source.sendMessage(this.errorOccurred);