refactor: fix FindAltsCommand (again) but also attempt to make it more readable
This commit is contained in:
parent
210dd7aaa1
commit
cc635ca8c6
2 changed files with 14 additions and 5 deletions
|
@ -1 +1 @@
|
|||
2073
|
||||
2075
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue