Merge pull request #37 from oskar3123/35-fix-configurable-format-in-velocity

Fix configurable format in velocity
This commit is contained in:
2025-02-08 03:35:25 +01:00
committed by GitHub
@@ -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);