diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java
index cfdeb187..5dcf18ab 100644
--- a/commons/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java
+++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java
@@ -8,6 +8,13 @@ import me.totalfreedom.totalfreedommod.rank.Displayable;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FSync;
import me.totalfreedom.totalfreedommod.util.FUtil;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.format.StyleBuilderApplicable;
+import net.kyori.adventure.text.format.TextColor;
+import net.kyori.adventure.text.minimessage.tag.Tag;
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Sound;
import org.bukkit.SoundCategory;
@@ -150,7 +157,8 @@ public class ChatManager extends FreedomService
Displayable display = plugin.rm.getDisplay(sender);
FLog.info("[ADMIN] " + sender.getName() + " " + display.getTag() + ": " + message, true);
- if (plugin.dc != null) {
+ if (plugin.dc != null)
+ {
plugin.dc.messageAdminChatChannel(sender.getName() + " \u00BB " + message);
}
@@ -160,12 +168,16 @@ public class ChatManager extends FreedomService
if (!Strings.isNullOrEmpty(admin.getAcFormat()))
{
String format = admin.getAcFormat();
- ChatColor color = getColor(display);
- String msg = format.replace("%name%", sender.getName()).replace("%rank%", display.getAbbr()).replace("%rankcolor%", color.toString()).replace("%msg%", message);
- player.sendMessage(FUtil.colorize(msg));
+
+ player.sendMessage(FUtil.miniMessage(format,
+ Placeholder.unparsed("name", sender.getName()),
+ Placeholder.unparsed("rank", display.getAbbr()),
+ TagResolver.resolver("rankcolor", Tag.styling(TextColor.color(getColor(display).getColor().getRGB()))),
+ Placeholder.unparsed("message", message)));
}
else
{
+ // OH GOD, WHY ARE WE DOING THIS
player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + sender.getName() + ChatColor.DARK_GRAY + " [" + getColoredTag(display) + ChatColor.DARK_GRAY + "]" + ChatColor.WHITE + ": " + ChatColor.GOLD + FUtil.colorize(message));
}
});
@@ -173,13 +185,17 @@ public class ChatManager extends FreedomService
public void reportAction(Player reporter, String reportedName, String report)
{
- for (Player player : server.getOnlinePlayers())
- {
- if (plugin.al.isAdmin(player))
- {
- playerMsg(player, ChatColor.RED + "[REPORTS] " + ChatColor.GOLD + reporter.getName() + " has reported " + reportedName + " for " + report);
- }
- }
- FLog.info("[REPORTS] " + reporter.getName() + " has reported " + reportedName + " for " + report);
+ messageAllAdmins("[REPORTS] has reported for .",
+ Placeholder.unparsed("reporter", reporter.getName()),
+ Placeholder.unparsed("reported", reportedName),
+ Placeholder.unparsed("reason", report));
+ }
+
+ public void messageAllAdmins(String message, TagResolver... placeholders)
+ {
+ Component parsed = FUtil.MINI_MESSAGE.deserialize(message, placeholders);
+ plugin.getComponentLogger().info(parsed);
+ server.getOnlinePlayers().stream().filter(player -> plugin.al.isAdmin(player)).forEach(player ->
+ player.sendMessage(parsed));
}
}
\ No newline at end of file
diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java
index 6fc60a56..47d64f93 100644
--- a/commons/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java
+++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java
@@ -1,5 +1,6 @@
package me.totalfreedom.totalfreedommod;
+import com.google.common.base.Strings;
import io.papermc.lib.PaperLib;
import java.util.ArrayList;
import java.util.List;
@@ -10,9 +11,11 @@ import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.player.PlayerData;
+import me.totalfreedom.totalfreedommod.util.FConverter;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FSync;
import me.totalfreedom.totalfreedommod.util.FUtil;
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -200,24 +203,21 @@ public class LoginProcess extends FreedomService
@Override
public void run()
{
- for (String line : ConfigEntry.FIRST_JOIN_INFO.getStringList())
- {
- player.sendMessage(FUtil.colorize(line));
- }
+ ConfigEntry.FIRST_JOIN_INFO.getStringList().forEach(line -> FUtil.playerMsgCooler(player, line));
}
}.runTaskLater(plugin, 20);
}
- player.sendTitle(FUtil.colorize(ConfigEntry.SERVER_LOGIN_TITLE.getString()), FUtil.colorize(ConfigEntry.SERVER_LOGIN_SUBTITLE.getString()), 20, 100, 60);
+ FUtil.playerTitle(player, ConfigEntry.SERVER_LOGIN_TITLE.getString(), ConfigEntry.SERVER_LOGIN_SUBTITLE.getString());
if (TELEPORT_ON_JOIN.contains(player.getName()) || ConfigEntry.AUTO_TP.getBoolean())
{
int x = FUtil.randomInteger(-10000, 10000);
int z = FUtil.randomInteger(-10000, 10000);
- int y = player.getWorld().getHighestBlockYAt(x, z);
+ int y = player.getWorld().getHighestBlockYAt(x, z) + 1;
Location location = new Location(player.getLocation().getWorld(), x, y, z);
PaperLib.teleportAsync(player, location);
- player.sendMessage(ChatColor.AQUA + "You have been teleported to a random location automatically.");
+ FUtil.playerMsgCooler(player, "You have been automatically teleported to a random location.");
return;
}
@@ -230,18 +230,18 @@ public class LoginProcess extends FreedomService
if (CLEAR_ON_JOIN.contains(player.getName()) || ConfigEntry.AUTO_CLEAR.getBoolean())
{
player.getInventory().clear();
- player.sendMessage(ChatColor.AQUA + "Your inventory has been cleared automatically.");
+ FUtil.playerMsgCooler(player, "Your inventory has been automatically cleared.");
return;
}
if (!ConfigEntry.SERVER_TABLIST_HEADER.getString().isEmpty())
{
- player.setPlayerListHeader(FUtil.colorize(ConfigEntry.SERVER_TABLIST_HEADER.getString()).replace("\\n", "\n"));
+ player.sendPlayerListHeader(FUtil.miniMessage(ConfigEntry.SERVER_TABLIST_HEADER.getString()));
}
if (!ConfigEntry.SERVER_TABLIST_FOOTER.getString().isEmpty())
{
- player.setPlayerListFooter(FUtil.colorize(ConfigEntry.SERVER_TABLIST_FOOTER.getString()).replace("\\n", "\n"));
+ player.sendPlayerListFooter(FUtil.miniMessage(ConfigEntry.SERVER_TABLIST_FOOTER.getString()));
}
if (!plugin.al.isAdmin(player))
@@ -255,10 +255,22 @@ public class LoginProcess extends FreedomService
int noteCount = playerData.getNotes().size();
if (noteCount != 0)
{
- String noteMessage = "This player has " + noteCount + " admin note" + (noteCount > 1 ? "s" : "") + ".";
- FLog.info(noteMessage);
- plugin.al.messageAllAdmins(ChatColor.GOLD + noteMessage);
- plugin.al.messageAllAdmins(ChatColor.GOLD + "Do " + ChatColor.YELLOW + "/notes " + player.getName() + " list" + ChatColor.GOLD + " to view them.");
+ plugin.cm.messageAllAdmins("This player has admin note.",
+ Placeholder.unparsed("count", String.valueOf(noteCount)), Placeholder.unparsed("plural", noteCount > 1 ? "s" : ""));
+ plugin.cm.messageAllAdmins("Do /notes list to view them.",
+ Placeholder.unparsed("player", player.getName()));
+ }
+ }
+ else
+ {
+ Admin admin = plugin.al.getAdmin(player);
+ String format = admin.getAcFormat();
+
+ if (!Strings.isNullOrEmpty(format) && FConverter.needsConversion(admin.getAcFormat()))
+ {
+ player.sendMessage(FUtil.miniMessage("Converting your admin chat format..."));
+ admin.setAcFormat(FConverter.convertAdminChatFormat(format));
+ plugin.al.save(admin);
}
}
@@ -269,12 +281,12 @@ public class LoginProcess extends FreedomService
{
if (ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
{
- player.sendMessage(ChatColor.RED + "Server is currently closed to non-admins.");
+ FUtil.playerMsgCooler(player, "Server is currently closed to non-admins.");
}
if (lockdownEnabled)
{
- FUtil.playerMsg(player, "Warning: Server is currenty in lockdown-mode, new players will not be able to join!", ChatColor.RED);
+ FUtil.playerMsgCooler(player, "Warning: Server is currenty in lockdown-mode, new players will not be able to join!");
}
}
}.runTaskLater(plugin, 20L);
diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java
index 42eaf643..be065fd0 100644
--- a/commons/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java
+++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java
@@ -3,6 +3,7 @@ package me.totalfreedom.totalfreedommod;
import com.google.gson.Gson;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.util.FUtil;
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -32,52 +33,35 @@ public class ServerPing extends FreedomService
if (plugin.bm.isIpBanned(ip))
{
- event.setMotd(FUtil.colorize(ConfigEntry.SERVER_BAN_MOTD.getString()));
+ event.motd(FUtil.miniMessage(ConfigEntry.SERVER_BAN_MOTD.getString()));
return;
}
if (ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
{
- event.setMotd(FUtil.colorize(ConfigEntry.SERVER_ADMINMODE_MOTD.getString()));
+ event.motd(FUtil.miniMessage(ConfigEntry.SERVER_ADMINMODE_MOTD.getString()));
return;
}
if (LoginProcess.isLockdownEnabled())
{
- event.setMotd(FUtil.colorize(ConfigEntry.SERVER_LOCKDOWN_MOTD.getString()));
+ event.motd(FUtil.miniMessage(ConfigEntry.SERVER_LOCKDOWN_MOTD.getString()));
return;
}
if (Bukkit.hasWhitelist())
{
- event.setMotd(FUtil.colorize(ConfigEntry.SERVER_WHITELIST_MOTD.getString()));
+ event.motd(FUtil.miniMessage(ConfigEntry.SERVER_WHITELIST_MOTD.getString()));
return;
}
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getMaxPlayers())
{
- event.setMotd(FUtil.colorize(ConfigEntry.SERVER_FULL_MOTD.getString()));
+ event.motd(FUtil.miniMessage(ConfigEntry.SERVER_FULL_MOTD.getString()));
return;
}
- String baseMotd = ConfigEntry.SERVER_MOTD.getString().replace("%mcversion%", meta.id);
- baseMotd = baseMotd.replace("\\n", "\n");
- baseMotd = FUtil.colorize(baseMotd);
-
- if (!ConfigEntry.SERVER_COLORFUL_MOTD.getBoolean())
- {
- event.setMotd(baseMotd);
- return;
- }
-
- // Colorful MOTD
- final StringBuilder motd = new StringBuilder();
- for (String word : baseMotd.split(" "))
- {
- motd.append(FUtil.randomChatColor()).append(word).append(" ");
- }
-
- event.setMotd(motd.toString().trim());
+ event.motd(FUtil.miniMessage(ConfigEntry.SERVER_MOTD.getString(), Placeholder.unparsed("version", meta.id)));
}
private static class VersionMeta
diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/VanishHandler.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/VanishHandler.java
index 8e62c11c..9814d67b 100644
--- a/commons/src/main/java/me/totalfreedom/totalfreedommod/VanishHandler.java
+++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/VanishHandler.java
@@ -1,11 +1,7 @@
package me.totalfreedom.totalfreedommod;
-import me.totalfreedom.totalfreedommod.util.FLog;
-import net.kyori.adventure.text.Component;
-import net.kyori.adventure.text.format.NamedTextColor;
-import net.md_5.bungee.api.ChatMessageType;
-import net.md_5.bungee.api.chat.TextComponent;
-import org.bukkit.ChatColor;
+import me.totalfreedom.totalfreedommod.util.FUtil;
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -39,8 +35,7 @@ public class VanishHandler extends FreedomService
if (plugin.al.isVanished(player.getUniqueId()))
{
plugin.esb.setVanished(player.getName(), true);
- FLog.info(player.getName() + " joined while still vanished.");
- plugin.al.messageAllAdmins(ChatColor.YELLOW + player.getName() + " has joined silently.");
+ plugin.cm.messageAllAdmins(" has joined silently.", Placeholder.unparsed("player", player.getName()));
event.joinMessage(null);
new BukkitRunnable()
@@ -50,7 +45,7 @@ public class VanishHandler extends FreedomService
{
if (plugin.al.isVanished(player.getUniqueId()))
{
- player.sendActionBar(Component.text("You are hidden from other players.").color(NamedTextColor.GOLD));
+ player.sendActionBar(FUtil.miniMessage("You are hidden from other players."));
}
else
{
@@ -69,8 +64,7 @@ public class VanishHandler extends FreedomService
if (plugin.al.isVanished(player.getUniqueId()))
{
event.quitMessage(null);
- FLog.info(player.getName() + " left while still vanished.");
- plugin.al.messageAllAdmins(ChatColor.YELLOW + player.getName() + " has left silently.");
+ plugin.cm.messageAllAdmins(" has left silently.", Placeholder.unparsed("player", player.getName()));
}
}
}
\ No newline at end of file
diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java
index 70843ffb..73a81894 100644
--- a/commons/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java
+++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java
@@ -4,9 +4,11 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
+import com.google.common.base.Strings;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
+import me.totalfreedom.totalfreedommod.util.FConverter;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.StringUtils;
diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java
index d71c993f..dec3e8ed 100644
--- a/commons/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java
+++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java
@@ -11,6 +11,7 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
+import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -67,6 +68,11 @@ public class AdminList extends FreedomService
FLog.info("Loaded " + allAdmins.size() + " admins (" + uuidTable.size() + " active, " + ipTable.size() + " IPs)");
}
+ public void messageAllAdmins(Component message)
+ {
+ server.getOnlinePlayers().stream().filter(this::isAdmin).forEach(player -> player.sendMessage(message));
+ }
+
public void messageAllAdmins(String message)
{
for (Player player : server.getOnlinePlayers())
diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java
index a70fce45..c9c43050 100644
--- a/commons/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java
+++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java
@@ -4,8 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
-/* TODO This will have to be changed from com.github.atlasmediagroup.scissors to me.totalfreedom.scissors when we migrate to 1.19 */
-import com.github.atlasmediagroup.scissors.event.block.MasterBlockFireEvent;
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
import io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java
index aad8c8aa..3d000623 100644
--- a/commons/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java
+++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java
@@ -52,10 +52,9 @@ public enum ConfigEntry
HTTPD_PORT(Integer.class, "httpd.port"),
HTTPD_PUBLIC_FOLDER(String.class, "httpd.public_folder"),
//
- SERVER_COLORFUL_MOTD(Boolean.class, "server.colorful_motd"),
SERVER_NAME(String.class, "server.name"),
SERVER_ADDRESS(String.class, "server.address"),
- SERVER_MOTD(String.class, "server.motd"),
+ SERVER_MOTD(String.class, "server.motds.normal"),
SERVER_LOGIN_TITLE(String.class, "server.login_title.title"),
SERVER_LOGIN_SUBTITLE(String.class, "server.login_title.subtitle"),
SERVER_OWNERS(List.class, "server.owners"),
diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/util/FConverter.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/util/FConverter.java
index 88d7e438..1d4affba 100644
--- a/commons/src/main/java/me/totalfreedom/totalfreedommod/util/FConverter.java
+++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/util/FConverter.java
@@ -1,2 +1,32 @@
-package me.totalfreedom.totalfreedommod.util;public class FConverter {
+package me.totalfreedom.totalfreedommod.util;
+
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+
+import java.util.regex.Pattern;
+
+public class FConverter
+{
+ private static final Pattern godFuckingDamnit = Pattern.compile(".*(?i)(&((#[a-f0-9]{3,6})|([0-9a-fklmnopr]))|%[a-z]+%).*");
+
+ public static boolean needsConversion(String messageOrFormat)
+ {
+ return godFuckingDamnit.matcher(messageOrFormat).find();
+ }
+
+ public static String convertAdminChatFormat(String format)
+ {
+ // %name%
+ // %rank%
+ // %rankcolor%
+ // %msg%
+
+ return FUtil.MINI_MESSAGE.serialize(FUtil.LEGACY_AMPERSAND.deserialize(
+ format.replaceAll("%name%", "")
+ .replaceAll("%rank%", "")
+ .replaceAll("%rankcolor%", "")
+ .replaceAll("%msg%", "")))
+ .replaceAll("\\\\<", "<"); // GOD FUCKING DAMMIT
+
+ //zTagResolver.resolver("rankcolor", Tag.styling(lol -> lol.color()))
+ }
}
diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
index 136e0893..cb59cdbd 100644
--- a/commons/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
+++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
@@ -4,7 +4,12 @@ import com.earth2me.essentials.utils.DateUtil;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.TextDecoration;
+import net.kyori.adventure.text.minimessage.MiniMessage;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
+import net.kyori.adventure.text.minimessage.tag.standard.StandardTags;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+import net.kyori.adventure.title.Title;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.WordUtils;
import org.bukkit.*;
@@ -14,11 +19,13 @@ import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
+import org.jetbrains.annotations.Contract;
import java.io.*;
import java.lang.management.ManagementFactory;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.time.Duration;
import java.time.Instant;
import java.util.*;
import java.util.regex.Matcher;
@@ -74,6 +81,14 @@ public class FUtil
"G6_",
"ayunami2000");
public static final LegacyComponentSerializer LEGACY_AMPERSAND = LegacyComponentSerializer.legacyAmpersand();
+ public static final MiniMessage MINI_MESSAGE = MiniMessage.builder().tags(TagResolver.resolver(
+ StandardTags.color(),
+ StandardTags.rainbow(),
+ StandardTags.gradient(),
+ StandardTags.decorations(TextDecoration.ITALIC),
+ StandardTags.decorations(TextDecoration.BOLD),
+ StandardTags.decorations(TextDecoration.STRIKETHROUGH),
+ StandardTags.decorations(TextDecoration.UNDERLINED))).build();
public static final Map CHAT_COLOR_NAMES = new HashMap<>();
public static final List CHAT_COLOR_POOL = Arrays.asList(
ChatColor.DARK_RED,
@@ -232,6 +247,24 @@ public class FUtil
FUtil.bcastMsg(message, null, true);
}
+ public static void playerTitle(CommandSender sender, String title, String subtitle, Title.Times times, TagResolver... placeholders)
+ {
+ Component compTitle = MINI_MESSAGE.deserialize(title, placeholders);
+ Component compSubtitle = MINI_MESSAGE.deserialize(subtitle, placeholders);
+
+ sender.showTitle(Title.title(compTitle, compSubtitle, times));
+ }
+
+ public static void playerTitle(CommandSender sender, String title, String subtitle, TagResolver... placeholders)
+ {
+ playerTitle(sender, title, subtitle, Title.Times.times(Duration.ofSeconds(1), Duration.ofSeconds(5), Duration.ofSeconds(3)), placeholders);
+ }
+
+ public static void playerMsgCooler(CommandSender sender, String message, TagResolver... placeholders)
+ {
+ sender.sendMessage(MINI_MESSAGE.deserialize(message, placeholders));
+ }
+
// Still in use by listeners
public static void playerMsg(CommandSender sender, String message, ChatColor color)
{
@@ -460,6 +493,11 @@ public class FUtil
return LEGACY_AMPERSAND.deserialize(string);
}
+ public static Component miniMessage(String string, TagResolver... placeholders)
+ {
+ return MINI_MESSAGE.deserialize(string, placeholders);
+ }
+
public static String stripColors(String string)
{
return string.replaceAll("ยง", "");
diff --git a/commons/src/main/resources/config.yml b/commons/src/main/resources/config.yml
index 6631fedb..36c50c00 100644
--- a/commons/src/main/resources/config.yml
+++ b/commons/src/main/resources/config.yml
@@ -10,24 +10,19 @@ server:
# The address your server is located at. Please do not include the port.
address: play.totalfreedom.me
- # Shown at the server list - Please note that support for %mcversion% has been withdrawn
- motd: TotalFreedom &8- The Original All-Op Server!
-
- # Every word in the MOTD will be a different color unless prefixed by a color code
- colorful_motd: true
-
# MOTD Modification
motds:
- ban: '&cYou are banned.'
- adminmode: '&cServer is closed.'
- lockdown: '&cServer is in lock-down.'
- whitelist: '&cWhitelist enabled.'
- full: '&cServer is full.'
+ ban: 'You are banned.'
+ adminmode: 'Server is closed.'
+ lockdown: 'Server is in lock-down.'
+ whitelist: 'Whitelist enabled.'
+ full: 'Server is full.'
+ normal: 'TotalFreedom - The Original All-Op Server!'
# Shown on join as a title
login_title:
- title: '&7Welcome to &6TotalFreedom&7!'
- subtitle: '&eThe Original All-Op Server!'
+ title: 'Welcome to TotalFreedom!'
+ subtitle: 'The Original All-Op Server!'
# All players who show up as owner
owners:
@@ -552,18 +547,17 @@ announcer:
- 'Join our Discord server! https://discord.com/invite/PW4savJR9a'
- 'Remember to save your hotbar, otherwise you may lose your items!'
- 'Link your discord account with &6/linkdiscord for extra features!'
- # - 'Check out our reddit at &6https://www.reddit.com/r/TotalFreedom/ &byou can even link your account!'
- 'Want to see cool builds? Check out our Master Builder World with &6/mbworld'
- 'Be sure to follow our twitter for all the latest updates. &6https://twitter.com/totalfreedommc'
# What to display in the admininfo command.
admininfo:
- - '&bHow to apply for an admin position on the TotalFreedom Server:'
- - ' &6- Do not ask for admin in game'
- - ' &2- Be helpful within the server'
- - ' &6- Report those breaking the rules'
- - ' &2- And apply on our forums at the link:'
- - '&9https://forum.totalfreedom.me/d/45-admin-application-template'
+ - 'How to apply for an admin position on the TotalFreedom Server:'
+ - ' - Do not ask for admin in game'
+ - ' - Be helpful within the server'
+ - ' - Report those breaking the rules'
+ - ' - And apply on our forums at the link:'
+ - 'https://forum.totalfreedom.me/d/45-admin-application-template'
# What to display in the vote command.
votinginfo:
@@ -579,20 +573,20 @@ votinginfo:
# What to display in the Master Builder info command.
masterbuilderinfo:
- - '&bHow to apply for Master Builder on the TotalFreedom Server:'
- - ' &6- Do not ask for Master Builder in game'
- - ' &2- Screenshot some of your previous builds (be ready to prove that the builds are yours)'
- - ' &6- Copy the template and create a thread on our forums'
- - ' &2- Template:'
- - '&9https://forum.totalfreedom.me/d/336-master-builder-application-process'
+ - 'How to apply for Master Builder on the TotalFreedom Server:'
+ - ' - Do not ask for Master Builder in game'
+ - ' - Screenshot some of your previous builds (be ready to prove that the builds are yours)'
+ - ' - Copy the template and create a thread on our forums'
+ - ' - Template:'
+ - 'https://forum.totalfreedom.me/d/336-master-builder-application-process'
# What new players will see upon joining for the first time.
first_join_info:
enabled: true
text:
- - "&6Welcome to TotalFreedom -- the original Free-OP server!"
- - "&eThe server's name doesn't mean we have no rules. Do &6/rules &efor a list of them."
- - "&aNeed help getting started? Do &2/help &aor a list of commands!"
+ - "Welcome to TotalFreedom -- the original Free-OP server!"
+ - "The server's name doesn't mean we have no rules. Do /rules for a list of them."
+ - "Need help getting started? Do /help for a list of commands!"
# Pet Protect - Prevent tamed pets from being killed.
petprotect:
diff --git a/pom.xml b/pom.xml
index f26da973..c25e6db9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,8 +102,8 @@
me.totalfreedom.scissors
- scissors-api
- 1.17.1-R0.1-SNAPSHOT
+ Scissors-API
+ 1.19.3-R0.1-SNAPSHOT
provided