add the ability to overide the chat

This commit is contained in:
Taah
2022-05-05 21:27:32 -07:00
parent 048518dc49
commit 38b18e5867
7 changed files with 68 additions and 18 deletions

View File

@ -13,6 +13,7 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -23,7 +24,7 @@ public class ServerListener extends PlexListener
@Subscribe(order = PostOrder.FIRST)
public void onPing(ProxyPingEvent event)
{
String baseMotd = plugin.getConfig().as(ServerSettings.class).getServer().getMotd();
String baseMotd = plugin.getConfig().as(ServerSettings.class).getServer().getMotd().get(ThreadLocalRandom.current().nextInt(plugin.getConfig().as(ServerSettings.class).getServer().getMotd().size()));
baseMotd = baseMotd.replace("\\n", "\n");
baseMotd = baseMotd.replace("%servername%", plugin.getConfig().as(ServerSettings.class).getServer().getName());
baseMotd = baseMotd.replace("%mcversion%", plugin.getServer().getVersion().getVersion().split(" ")[0]);

View File

@ -15,7 +15,7 @@ public class ServerSettings
@Data
public static class Server {
private String name = "Server";
private String motd = "%randomgradient%%servername% - %mcversion%";
private List<String> motd = Lists.newArrayList("%randomgradient%%servername% - %mcversion%", "Another motd");
private boolean colorizeMotd = false;
private boolean debug = false;
private final List<String> sample = Lists.newArrayList("example", "example");

View File

@ -13,7 +13,7 @@
# %servername% - The name provided above
# %randomgradient% - Creates a random gradient every ping of two random colors for the whole string
# Supports MiniMessage strings, no legacy & and §
motd = "%randomgradient%%servername% - %mcversion%"
motd = ["%randomgradient%%servername% - %mcversion%", "Another motd"]
colorizeMotd = false
# Enables debug messages