aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java
diff options
context:
space:
mode:
authormdxd44 <ogurec332@mail.ru>2022-05-20 02:46:31 +0900
committermdxd44 <ogurec332@mail.ru>2022-05-20 02:46:31 +0900
commit85b5811d3f71928f6f243e039a8bf112c0142b12 (patch)
treef41f7e5a62c9ee48acb76e03549df889e2816b77 /src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java
parent35d932ddfa02e2fc5236dcf07c1606b73b6e3585 (diff)
downloadLimboAuth-85b5811d3f71928f6f243e039a8bf112c0142b12.tar.gz
LimboAuth-85b5811d3f71928f6f243e039a8bf112c0142b12.tar.bz2
LimboAuth-85b5811d3f71928f6f243e039a8bf112c0142b12.zip
Massive code refactor, update dependencies, etc.
Лень фулл писать. Closes #26
Diffstat (limited to 'src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java')
-rw-r--r--src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java b/src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java
index dabe70b..2fd12ca 100644
--- a/src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java
+++ b/src/main/java/net/elytrium/limboauth/command/ForceUnregisterCommand.java
@@ -25,12 +25,12 @@ import java.sql.SQLException;
import java.text.MessageFormat;
import java.util.List;
import java.util.Locale;
+import net.elytrium.java.commons.mc.serialization.Serializer;
+import net.elytrium.java.commons.mc.velocity.commands.SuggestUtils;
import net.elytrium.limboauth.LimboAuth;
import net.elytrium.limboauth.Settings;
import net.elytrium.limboauth.model.RegisteredPlayer;
-import net.elytrium.limboauth.utils.SuggestUtils;
import net.kyori.adventure.text.Component;
-import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
public class ForceUnregisterCommand implements SimpleCommand {
@@ -48,15 +48,16 @@ public class ForceUnregisterCommand implements SimpleCommand {
this.server = server;
this.playerDao = playerDao;
- this.kick = LegacyComponentSerializer.legacyAmpersand().deserialize(Settings.IMP.MAIN.STRINGS.FORCE_UNREGISTER_KICK);
+ Serializer serializer = LimboAuth.getSerializer();
+ this.kick = serializer.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);
+ this.usage = serializer.deserialize(Settings.IMP.MAIN.STRINGS.FORCE_UNREGISTER_USAGE);
}
@Override
public List<String> suggest(SimpleCommand.Invocation invocation) {
- return SuggestUtils.suggestPlayers(invocation.arguments(), this.server);
+ return SuggestUtils.suggestPlayers(this.server, invocation.arguments(), 0);
}
@Override
@@ -67,20 +68,19 @@ public class ForceUnregisterCommand implements SimpleCommand {
if (args.length == 1) {
String playerNick = args[0];
+ Serializer serializer = LimboAuth.getSerializer();
try {
this.playerDao.deleteById(playerNick.toLowerCase(Locale.ROOT));
this.plugin.removePlayerFromCache(playerNick);
this.server.getPlayer(playerNick).ifPresent(player -> player.disconnect(this.kick));
- source.sendMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(MessageFormat.format(this.successful, playerNick)));
+ source.sendMessage(serializer.deserialize(MessageFormat.format(this.successful, playerNick)));
} catch (SQLException e) {
- source.sendMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(MessageFormat.format(this.notSuccessful, playerNick)));
+ source.sendMessage(serializer.deserialize(MessageFormat.format(this.notSuccessful, playerNick)));
e.printStackTrace();
}
-
- return;
+ } else {
+ source.sendMessage(this.usage);
}
-
- source.sendMessage(this.usage);
}
@Override