diff --git a/src/main/java/net/elytrium/limboauth/Settings.java b/src/main/java/net/elytrium/limboauth/Settings.java index e19fff0b..64ee1ff4 100644 --- a/src/main/java/net/elytrium/limboauth/Settings.java +++ b/src/main/java/net/elytrium/limboauth/Settings.java @@ -501,6 +501,7 @@ public static class STRINGS { public String TOTP_RECOVERY = "{PRFX} &aYour recovery codes &7(Click to copy)&a: &6{0}"; public String DESTROY_SESSION_SUCCESSFUL = "{PRFX} &eYour session is now destroyed, you'll need to log in again after reconnecting."; + public String DESTROY_SESSION_KICK = "{PRFX} &eYour session has been destroyed. Please reconnect to log in again."; public String MOD_SESSION_EXPIRED = "{PRFX} Your session has expired, log in again."; } diff --git a/src/main/java/net/elytrium/limboauth/command/DestroySessionCommand.java b/src/main/java/net/elytrium/limboauth/command/DestroySessionCommand.java index 864bfcab..ec99992b 100644 --- a/src/main/java/net/elytrium/limboauth/command/DestroySessionCommand.java +++ b/src/main/java/net/elytrium/limboauth/command/DestroySessionCommand.java @@ -29,22 +29,25 @@ public class DestroySessionCommand extends RatelimitedCommand { private final LimboAuth plugin; - private final Component successful; + private final Component kick; private final Component notPlayer; + private final Component successful; public DestroySessionCommand(LimboAuth plugin) { this.plugin = plugin; Serializer serializer = LimboAuth.getSerializer(); this.successful = serializer.deserialize(Settings.IMP.MAIN.STRINGS.DESTROY_SESSION_SUCCESSFUL); + this.kick = serializer.deserialize(Settings.IMP.MAIN.STRINGS.DESTROY_SESSION_KICK); this.notPlayer = serializer.deserialize(Settings.IMP.MAIN.STRINGS.NOT_PLAYER); } @Override public void execute(CommandSource source, String[] args) { - if (source instanceof Player) { - this.plugin.removePlayerFromCache(((Player) source).getUsername()); - source.sendMessage(this.successful); + if (source instanceof Player player) { + this.plugin.removePlayerFromCache(player.getUsername()); + player.sendMessage(this.successful); + player.disconnect(this.kick); } else { source.sendMessage(this.notPlayer); }