refactor: fix FindAltsCommand (again) but also attempt to make it more readable

This commit is contained in:
Chayapak 2025-03-22 15:39:02 +07:00
parent 210dd7aaa1
commit cc635ca8c6
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA
2 changed files with 14 additions and 5 deletions
build-number.txt
src/main/java/me/chayapak1/chomens_bot/commands

View file

@ -1 +1 @@
2073
2075

View file

@ -39,10 +39,19 @@ public class FindAltsCommand extends Command {
final boolean allServer = flag.equals("-allserver");
// ohio code
String player = !allServer ? flag : ""; // adds the first argument if no flag
final String restPlayer = context.getString(true, false);
if (!restPlayer.isEmpty()) player += " " + restPlayer;
String player;
if (allServer) {
player = context.getString(true, true);
} else {
final String rest = context.getString(true, false);
player = flag +
(
rest.isEmpty() ?
"" :
" " + rest
);
}
final PlayerEntry playerEntry = bot.players.getEntry(player);