#35: actually use the configurable format for velocity

This commit is contained in:
2025-02-08 03:33:18 +01:00
parent 1c9487d52d
commit e3ecac87c7
@@ -13,8 +13,6 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
public class VelocityStaffChatHandler { public class VelocityStaffChatHandler {
private static final String DEFAULT_FORMAT = "&b{NAME}: {MESSAGE}";
private final VelocityStaffChat plugin; private final VelocityStaffChat plugin;
private final Set<UUID> toggledPlayers; private final Set<UUID> toggledPlayers;
@@ -38,13 +36,10 @@ public class VelocityStaffChatHandler {
} }
public void broadcastStaffMessage(Player sender, String message) { public void broadcastStaffMessage(Player sender, String message) {
if (message.isEmpty()) { String format = plugin.getConfig().node("settings", "format").getString("&b{NAME}: {MESSAGE}");
return;
}
String formattedMessage = String formattedMessage =
FormatUtils.replacePlaceholders( FormatUtils.replacePlaceholders(format, Function.identity(), sender::getUsername, message);
DEFAULT_FORMAT, Function.identity(), sender::getUsername, message);
TextComponent component = TextComponent component =
LegacyComponentSerializer.legacyAmpersand().deserialize(formattedMessage); LegacyComponentSerializer.legacyAmpersand().deserialize(formattedMessage);