Fix SeenCommand when the same player is online in multiple servers
This commit is contained in:
parent
9b214c7111
commit
32c3801acf
1 changed files with 17 additions and 5 deletions
|
@ -34,13 +34,25 @@ public class SeenCommand extends Command {
|
||||||
|
|
||||||
final String player = context.getString(true, true);
|
final String player = context.getString(true, true);
|
||||||
|
|
||||||
|
boolean online = false;
|
||||||
|
|
||||||
|
Component onlineComponents = Component.empty();
|
||||||
|
|
||||||
for (Bot eachBot : bot.bots) {
|
for (Bot eachBot : bot.bots) {
|
||||||
if (eachBot.players.getEntry(player) != null) return Component.empty()
|
if (eachBot.players.getEntry(player) != null) {
|
||||||
|
online = true;
|
||||||
|
|
||||||
|
onlineComponents = onlineComponents.append(
|
||||||
|
Component.empty()
|
||||||
.append(Component.text(player))
|
.append(Component.text(player))
|
||||||
.append(Component.text(" is currently online on "))
|
.append(Component.text(" is currently online on "))
|
||||||
.append(Component.text(eachBot.host + ":" + eachBot.port))
|
.append(Component.text(eachBot.host + ":" + eachBot.port))
|
||||||
.color(NamedTextColor.RED);
|
.color(NamedTextColor.RED)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (online) return onlineComponents;
|
||||||
|
|
||||||
final JsonElement playerElement = PlayersPersistentDataPlugin.playersObject.get(player);
|
final JsonElement playerElement = PlayersPersistentDataPlugin.playersObject.get(player);
|
||||||
if (playerElement == null) throw new CommandException(Component.translatable(
|
if (playerElement == null) throw new CommandException(Component.translatable(
|
||||||
|
|
Loading…
Reference in a new issue