diff --git a/README.md b/README.md index 6024b59..44ca73d 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Simply download the latest release and place it in your Velocity plugins folder Velocitab has a simple config file that lets you define a header, footer and format for the player list. You can additionally configure [groups of servers](https://william278.net/docs/velocitab/server-groups) to display different formats in the TAB menu depending on which server the player is viewing it from. ### Formatting -Velocitab [supports](https://william278.net/docs/velocitab/formatting) the full range of RGB colors and gradients, with options to use either MineDown (_default_) or MiniMessage formatting. +Velocitab [supports](https://william278.net/docs/velocitab/formatting) the full range of RGB colors and gradients, with options to use either MineDown (_default_), MiniMessage, or legacy formatting. ### Placeholders You can include [placeholders](https://william278.net/docs/velocitab/placeholders) in the header, footer and player name format of the TAB list. The following placeholders are supported: diff --git a/src/main/java/net/william278/velocitab/config/Formatter.java b/src/main/java/net/william278/velocitab/config/Formatter.java index 9346a99..9060c6b 100644 --- a/src/main/java/net/william278/velocitab/config/Formatter.java +++ b/src/main/java/net/william278/velocitab/config/Formatter.java @@ -3,6 +3,7 @@ package net.william278.velocitab.config; import de.themoep.minedown.adventure.MineDown; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.william278.velocitab.Velocitab; import net.william278.velocitab.player.TabPlayer; import org.apache.commons.lang3.function.TriFunction; @@ -20,7 +21,9 @@ public enum Formatter { MINIMESSAGE((text, player, plugin) -> plugin.getMiniPlaceholdersHook() .map(hook -> hook.format(text, player.getPlayer())) .orElse(MiniMessage.miniMessage().deserialize(text)), - (text) -> MiniMessage.miniMessage().escapeTags(text)); + (text) -> MiniMessage.miniMessage().escapeTags(text)), + LEGACY((text, player, plugin) -> LegacyComponentSerializer.legacyAmpersand().deserialize(text), + Function.identity()); /** * Function to apply formatting to a string diff --git a/src/main/java/net/william278/velocitab/config/Settings.java b/src/main/java/net/william278/velocitab/config/Settings.java index 4d8755e..a350c9d 100644 --- a/src/main/java/net/william278/velocitab/config/Settings.java +++ b/src/main/java/net/william278/velocitab/config/Settings.java @@ -32,7 +32,7 @@ public class Settings { private Map formats = Map.of("default", "&7[%server%] &f%prefix%%username%"); @Getter - @YamlComment("Which text formatter to use (MINEDOWN or MINIMESSAGE)") + @YamlComment("Which text formatter to use (MINEDOWN, MINIMESSAGE, or LEGACY)") @YamlKey("formatting_type") private Formatter formatter = Formatter.MINEDOWN;