forked from Upstream/Velocitab
Support legacy RGB color codes (#37)
This commit is contained in:
parent
ec0e962761
commit
3c7187cca0
@ -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.
|
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
|
### 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
|
### 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:
|
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:
|
||||||
|
@ -3,6 +3,7 @@ package net.william278.velocitab.config;
|
|||||||
import de.themoep.minedown.adventure.MineDown;
|
import de.themoep.minedown.adventure.MineDown;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import net.william278.velocitab.Velocitab;
|
import net.william278.velocitab.Velocitab;
|
||||||
import net.william278.velocitab.player.TabPlayer;
|
import net.william278.velocitab.player.TabPlayer;
|
||||||
import org.apache.commons.lang3.function.TriFunction;
|
import org.apache.commons.lang3.function.TriFunction;
|
||||||
@ -20,7 +21,9 @@ public enum Formatter {
|
|||||||
MINIMESSAGE((text, player, plugin) -> plugin.getMiniPlaceholdersHook()
|
MINIMESSAGE((text, player, plugin) -> plugin.getMiniPlaceholdersHook()
|
||||||
.map(hook -> hook.format(text, player.getPlayer()))
|
.map(hook -> hook.format(text, player.getPlayer()))
|
||||||
.orElse(MiniMessage.miniMessage().deserialize(text)),
|
.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
|
* Function to apply formatting to a string
|
||||||
|
@ -32,7 +32,7 @@ public class Settings {
|
|||||||
private Map<String, String> formats = Map.of("default", "&7[%server%] &f%prefix%%username%");
|
private Map<String, String> formats = Map.of("default", "&7[%server%] &f%prefix%%username%");
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@YamlComment("Which text formatter to use (MINEDOWN or MINIMESSAGE)")
|
@YamlComment("Which text formatter to use (MINEDOWN, MINIMESSAGE, or LEGACY)")
|
||||||
@YamlKey("formatting_type")
|
@YamlKey("formatting_type")
|
||||||
private Formatter formatter = Formatter.MINEDOWN;
|
private Formatter formatter = Formatter.MINEDOWN;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user