Actually fix it

This commit is contained in:
Telesphoreo 2022-04-19 15:58:38 -05:00
parent 730f7c5ea0
commit bae1e49c5e
2 changed files with 4 additions and 3 deletions

View File

@ -25,8 +25,8 @@ public class ServerListener extends PlexListener
AtomicReference<Component> motd = new AtomicReference<>(Component.empty()); AtomicReference<Component> motd = new AtomicReference<>(Component.empty());
for (final String word : baseMotd.split(" ")) for (final String word : baseMotd.split(" "))
{ {
motd.get().append(Component.text(word).color(RandomUtil.getRandomColor())); motd.set(motd.get().append(Component.text(word).color(RandomUtil.getRandomColor())));
motd.get().append(Component.space()); motd.set(motd.get().append(Component.space()));
} }
event.motd(motd.get()); event.motd(motd.get());
} }

View File

@ -1,5 +1,6 @@
package dev.plex.util; package dev.plex.util;
import java.util.Arrays;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
@ -8,7 +9,7 @@ public class RandomUtil
public static NamedTextColor getRandomColor() public static NamedTextColor getRandomColor()
{ {
NamedTextColor[] colors = NamedTextColor.NAMES.values().toArray(NamedTextColor[]::new); NamedTextColor[] colors = NamedTextColor.NAMES.values().stream().filter(namedTextColor -> namedTextColor != NamedTextColor.BLACK && namedTextColor != NamedTextColor.DARK_BLUE).toArray(NamedTextColor[]::new);
return colors[randomNum(colors.length)]; return colors[randomNum(colors.length)];
} }