forked from ChomeNS/chomens-bot-java
Fix newline on SeenCommand
This commit is contained in:
parent
3740a9b45f
commit
0d73ddd791
1 changed files with 7 additions and 3 deletions
|
@ -10,12 +10,16 @@ import me.chayapak1.chomens_bot.command.TrustLevel;
|
||||||
import me.chayapak1.chomens_bot.plugins.PlayersPersistentDataPlugin;
|
import me.chayapak1.chomens_bot.plugins.PlayersPersistentDataPlugin;
|
||||||
import me.chayapak1.chomens_bot.util.ColorUtilities;
|
import me.chayapak1.chomens_bot.util.ColorUtilities;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.JoinConfiguration;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.DateTimeZone;
|
import org.joda.time.DateTimeZone;
|
||||||
import org.joda.time.format.DateTimeFormat;
|
import org.joda.time.format.DateTimeFormat;
|
||||||
import org.joda.time.format.DateTimeFormatter;
|
import org.joda.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class SeenCommand extends Command {
|
public class SeenCommand extends Command {
|
||||||
public SeenCommand () {
|
public SeenCommand () {
|
||||||
super(
|
super(
|
||||||
|
@ -36,13 +40,13 @@ public class SeenCommand extends Command {
|
||||||
|
|
||||||
boolean online = false;
|
boolean online = false;
|
||||||
|
|
||||||
Component onlineComponents = Component.empty();
|
final List<Component> onlineComponents = new ArrayList<>();
|
||||||
|
|
||||||
for (Bot eachBot : bot.bots) {
|
for (Bot eachBot : bot.bots) {
|
||||||
if (eachBot.players.getEntry(player) != null) {
|
if (eachBot.players.getEntry(player) != null) {
|
||||||
online = true;
|
online = true;
|
||||||
|
|
||||||
onlineComponents = onlineComponents.append(
|
onlineComponents.add(
|
||||||
Component.empty()
|
Component.empty()
|
||||||
.append(Component.text(player))
|
.append(Component.text(player))
|
||||||
.append(Component.text(" is currently online on "))
|
.append(Component.text(" is currently online on "))
|
||||||
|
@ -52,7 +56,7 @@ public class SeenCommand extends Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (online) return onlineComponents;
|
if (online) return Component.join(JoinConfiguration.newlines(), 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