Compare commits
2 commits
743072d8e3
...
32c3801acf
Author | SHA1 | Date | |
---|---|---|---|
32c3801acf | |||
9b214c7111 |
2 changed files with 26 additions and 7 deletions
|
@ -33,6 +33,8 @@ public class FindAltsCommand extends Command {
|
|||
public Component execute(CommandContext context) throws Exception {
|
||||
final Bot bot = context.bot;
|
||||
|
||||
boolean argumentIsIP = true;
|
||||
|
||||
String targetIP;
|
||||
|
||||
final String player = context.getString(true, true);
|
||||
|
@ -41,6 +43,8 @@ public class FindAltsCommand extends Command {
|
|||
|
||||
if (playerEntry == null) targetIP = player;
|
||||
else {
|
||||
argumentIsIP = false;
|
||||
|
||||
final CompletableFuture<String> future = bot.players.getPlayerIP(playerEntry);
|
||||
|
||||
targetIP = future.get(5, TimeUnit.SECONDS);
|
||||
|
@ -67,9 +71,12 @@ public class FindAltsCommand extends Command {
|
|||
.map(Map.Entry::getKey);
|
||||
|
||||
Component component = Component
|
||||
.translatable("Possible alts for the player %s:")
|
||||
.translatable("Possible alts for the %s %s:")
|
||||
.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();
|
||||
|
||||
int i = 0;
|
||||
|
|
|
@ -34,13 +34,25 @@ public class SeenCommand extends Command {
|
|||
|
||||
final String player = context.getString(true, true);
|
||||
|
||||
boolean online = false;
|
||||
|
||||
Component onlineComponents = Component.empty();
|
||||
|
||||
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(" is currently online on "))
|
||||
.append(Component.text(eachBot.host + ":" + eachBot.port))
|
||||
.color(NamedTextColor.RED);
|
||||
.color(NamedTextColor.RED)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (online) return onlineComponents;
|
||||
|
||||
final JsonElement playerElement = PlayersPersistentDataPlugin.playersObject.get(player);
|
||||
if (playerElement == null) throw new CommandException(Component.translatable(
|
||||
|
|
Loading…
Reference in a new issue