Correct the message

This commit is contained in:
Chayapak 2024-10-26 18:18:16 +07:00
parent 743072d8e3
commit 9b214c7111

View file

@ -33,6 +33,8 @@ public class FindAltsCommand extends Command {
public Component execute(CommandContext context) throws Exception { public Component execute(CommandContext context) throws Exception {
final Bot bot = context.bot; final Bot bot = context.bot;
boolean argumentIsIP = true;
String targetIP; String targetIP;
final String player = context.getString(true, true); final String player = context.getString(true, true);
@ -41,6 +43,8 @@ public class FindAltsCommand extends Command {
if (playerEntry == null) targetIP = player; if (playerEntry == null) targetIP = player;
else { else {
argumentIsIP = false;
final CompletableFuture<String> future = bot.players.getPlayerIP(playerEntry); final CompletableFuture<String> future = bot.players.getPlayerIP(playerEntry);
targetIP = future.get(5, TimeUnit.SECONDS); targetIP = future.get(5, TimeUnit.SECONDS);
@ -67,9 +71,12 @@ public class FindAltsCommand extends Command {
.map(Map.Entry::getKey); .map(Map.Entry::getKey);
Component component = Component Component component = Component
.translatable("Possible alts for the player %s:") .translatable("Possible alts for the %s %s:")
.color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor)) .color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor))
.arguments(Component.text(player).color(ColorUtilities.getColorByString(bot.config.colorPalette.username))) .arguments(
Component.text(argumentIsIP ? "IP" : "player"),
Component.text(player).color(ColorUtilities.getColorByString(bot.config.colorPalette.username))
)
.appendNewline(); .appendNewline();
int i = 0; int i = 0;