This commit is contained in:
BuildTools committed 2024-02-16 03:58:50 +05:00
1 parent 5ad34d5749
commit 3dbcaa059c
19 files changed
+101 -513

No files matched your search

+8 -3
View File
@@ -6,7 +6,7 @@
<groupId>su.nightexpress.nightcore</groupId>
<artifactId>nightcore</artifactId>
<version>2.5.0</version>
<version>2.5.1</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
@@ -18,10 +18,12 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<!--<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repository>-->
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
@@ -29,14 +31,17 @@
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>opencollab-snapshot</id>
<url>https://repo.opencollab.dev/maven-snapshots/</url>
</repository>
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
@@ -7,7 +7,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import su.nightexpress.nightcore.command.CommandFlag;
import su.nightexpress.nightcore.language.entry.LangString;
import su.nightexpress.nightcore.language.legacy.LegacyLangString;
import su.nightexpress.nightcore.util.placeholder.Placeholder;
import java.util.Collection;
@@ -69,11 +68,6 @@ public interface NightCommand extends Placeholder {
@NotNull String getUsage();
@Deprecated
default void setUsage(@NotNull LegacyLangString string) {
this.setUsage(string.getString());
}
default void setUsage(@NotNull LangString string) {
this.setUsage(string.getString());
}
@@ -82,11 +76,6 @@ public interface NightCommand extends Placeholder {
@NotNull String getDescription();
@Deprecated
default void setDescription(@NotNull LegacyLangString string) {
this.setDescription(string.getString());
}
default void setDescription(@NotNull LangString string) {
this.setDescription(string.getString());
}
@@ -68,7 +68,7 @@ public class CoreConfig {
"[Default is true]");
public static final ConfigValue<Boolean> LEGACY_COLOR_SUPPORT = ConfigValue.create("Engine.Legacy_Color_Support",
false,
true,
"Allows to use legacy color codes (such as '&7', '&l', etc.) in plugin configurations.",
"This setting exist for backwards compatibility only! There are NO GUARANTEES that it will persist for future updates!",
"You should NOT use it unless you need to add support for your custom language configurations & translations with legacy codes.",
@@ -1,179 +0,0 @@
package su.nightexpress.nightcore.language.legacy;
import me.clip.placeholderapi.PlaceholderAPI;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import su.nightexpress.nightcore.NightCorePlugin;
import su.nightexpress.nightcore.language.message.OutputType;
import su.nightexpress.nightcore.util.Colorizer;
import su.nightexpress.nightcore.util.Players;
import su.nightexpress.nightcore.util.message.NexParser;
import su.nightexpress.nightcore.util.regex.TimedMatcher;
import su.nightexpress.nightcore.util.wrapper.UniSound;
import java.util.ArrayList;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;
import java.util.regex.Pattern;
@Deprecated
public class LegacyLangMessage {
private static final Pattern OPTIONS_PATTERN = Pattern.compile("<\\!(.*?)\\!>");
private final NightCorePlugin plugin;
private final LegacyMessageOptions options;
private final List<String> defaultText;
private List<String> text;
public LegacyLangMessage(@NotNull NightCorePlugin plugin, @NotNull List<String> defaultText) {
this.plugin = plugin;
this.options = new LegacyMessageOptions();
this.defaultText = defaultText;
this.setText(defaultText);
this.setOptions();
}
private LegacyLangMessage(@NotNull LegacyLangMessage from) {
this.plugin = from.plugin;
this.options = from.options.copy();
this.defaultText = new ArrayList<>(from.defaultText);
this.text = new ArrayList<>(from.text);
}
private void setOptions() {
List<String> text = this.getText();
if (text.isEmpty()) return;
String msg = text.get(0);
TimedMatcher matcher = TimedMatcher.create(OPTIONS_PATTERN, msg);
if (!matcher.find()) return;
String optionTag = matcher.getMatcher().group(0);
String optionArgs = matcher.getMatcher().group(1).trim();
this.text.set(0, msg.replace(optionTag, ""));
this.text.removeIf(String::isEmpty);
this.options.read(optionArgs);
}
@NotNull
public List<String> getDefaultText() {
return this.defaultText;
}
@NotNull
public List<String> getText() {
return this.text;
}
@NotNull
public List<String> getText(@NotNull CommandSender sender) {
if (!this.options.hasPlaceholderAPI() || !(sender instanceof Player player)) return this.getText();
List<String> text = new ArrayList<>(this.getText());
text.replaceAll(line -> PlaceholderAPI.setPlaceholders(player, line));
return text;
}
private void setText(@NotNull List<String> text) {
this.text = Colorizer.apply(text);
this.text.removeIf(String::isEmpty);
}
@NotNull
public LegacyLangMessage replace(@NotNull String var, @NotNull Object replacer) {
return this.replace(str -> str.replace(var, String.valueOf(replacer)));
}
@NotNull
public LegacyLangMessage replace(@NotNull UnaryOperator<String> replacer) {
if (this.isEmpty()) return this;
LegacyLangMessage msgCopy = new LegacyLangMessage(this);
msgCopy.getText().replaceAll(replacer);
return msgCopy;
}
@NotNull
public LegacyLangMessage replace(@NotNull Predicate<String> predicate, @NotNull BiConsumer<String, List<String>> replacer) {
if (this.isEmpty()) return this;
LegacyLangMessage msgCopy = new LegacyLangMessage(this);
List<String> replaced = new ArrayList<>();
msgCopy.getText().forEach(line -> {
if (predicate.test(line)) {
replacer.accept(line, replaced);
return;
}
replaced.add(line);
});
msgCopy.setText(replaced);
return msgCopy;
}
public boolean isEmpty() {
return (this.options.getType() == OutputType.NONE || this.getText().isEmpty());
}
public void broadcast() {
if (this.isEmpty()) return;
Bukkit.getServer().getOnlinePlayers().forEach(this::send);
this.send(Bukkit.getServer().getConsoleSender());
}
public void send(@NotNull CommandSender sender) {
if (this.isEmpty()) return;
if (this.options.getSound() != null && sender instanceof Player player) {
UniSound.of(this.options.getSound()).play(player);
}
if (this.options.getType() == OutputType.CHAT) {
String prefix = this.options.hasPrefix() ? plugin.getPrefix() : "";
this.getText(sender).forEach(line -> {
Players.sendRichMessage(sender, prefix + line);
});
return;
}
if (sender instanceof Player player) {
if (this.options.getType() == OutputType.ACTION_BAR) {
Players.sendActionBar(player, String.join(" ", this.getText(player)));
}
else if (this.options.getType() == OutputType.TITLES) {
List<String> list = this.getText(player);
String title = list.size() > 0 ? NexParser.toPlainText(list.get(0)) : "";
String subtitle = list.size() > 1 ? NexParser.toPlainText(list.get(1)) : "";
player.sendTitle(title, subtitle, this.options.getTitleTimes()[0], this.options.getTitleTimes()[1], this.options.getTitleTimes()[2]);
}
}
}
/*@NotNull
public List<String> asList() {
return this.asList(this.getText());
}
@NotNull
public List<String> asList(@NotNull CommandSender sender) {
return this.asList(this.getText(sender));
}
@NotNull
private List<String> asList(@NotNull String localized) {
return this.isEmpty() ? Collections.emptyList() : Stream.of(localized.split("\\\\n"))
.filter(Predicate.not(String::isEmpty)).toList();
}
@NotNull
@Deprecated
public String normalizeLines() {
return String.join("\n", this.asList());
}*/
}
@@ -1,53 +0,0 @@
package su.nightexpress.nightcore.language.legacy;
import org.jetbrains.annotations.NotNull;
import su.nightexpress.nightcore.NightCorePlugin;
import su.nightexpress.nightcore.config.FileConfig;
import su.nightexpress.nightcore.language.entry.LangEntry;
import su.nightexpress.nightcore.util.Colorizer;
@Deprecated
public class LegacyLangString extends LangEntry<String> {
private String string;
public LegacyLangString(@NotNull String path, @NotNull String defaultText) {
super(path, defaultText);
}
@NotNull
public static LegacyLangString of(@NotNull String path, @NotNull String defaultText) {
return new LegacyLangString(path, defaultText);
}
@Override
public boolean write(@NotNull FileConfig config) {
if (!config.contains(this.getPath())) {
String textDefault = this.getDefaultText();
config.set(this.getPath(), textDefault);
return true;
}
return false;
}
@Override
@NotNull
public String load(@NotNull NightCorePlugin plugin) {
FileConfig config = plugin.getLang();
this.write(config);
String text = config.getString(this.getPath(), "<" + this.getPath() + ">");
this.setString(text);
return this.getString();
}
@NotNull
public String getString() {
return string;
}
public void setString(@NotNull String string) {
this.string = Colorizer.apply(string);
}
}
@@ -1,68 +0,0 @@
package su.nightexpress.nightcore.language.legacy;
import org.jetbrains.annotations.NotNull;
import su.nightexpress.nightcore.NightCorePlugin;
import su.nightexpress.nightcore.config.FileConfig;
import su.nightexpress.nightcore.language.entry.LangEntry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Deprecated
public class LegacyLangText extends LangEntry<LegacyLangMessage> {
private LegacyLangMessage message;
public LegacyLangText(@NotNull String path, @NotNull String... defaultText) {
super(path, String.join("\n", defaultText));
}
@NotNull
public static LegacyLangText of(@NotNull String path, @NotNull String defaultText) {
return new LegacyLangText(path, defaultText);
}
@NotNull
public static LegacyLangText of(@NotNull String path, @NotNull String... defaultText) {
return new LegacyLangText(path, defaultText);
}
@Override
public boolean write(@NotNull FileConfig config) {
if (!config.contains(this.getPath())) {
String textDefault = this.getDefaultText();
String[] textSplit = textDefault.split("\n");
config.set(this.getPath(), textSplit.length > 1 ? Arrays.asList(textSplit) : textDefault);
return true;
}
return false;
}
@Override
@NotNull
public LegacyLangMessage load(@NotNull NightCorePlugin plugin) {
FileConfig config = plugin.getLang();
this.write(config);
List<String> text = new ArrayList<>(config.getStringList(this.getPath()));
if (text.isEmpty()) {
text.add(config.getString(this.getPath(), "<" + this.getPath() + ">"));
}
//String text = !list.isEmpty() ? String.join("\\n", list) : config.getString(this.getPath(), "<" + this.getPath() + ">");
this.setMessage(new LegacyLangMessage(plugin, text));
return this.getMessage();
}
@NotNull
public LegacyLangMessage getMessage() {
return message;
}
public void setMessage(@NotNull LegacyLangMessage message) {
this.message = message;
}
}
@@ -1,26 +0,0 @@
package su.nightexpress.nightcore.language.legacy;
import org.jetbrains.annotations.NotNull;
import java.util.regex.Pattern;
@Deprecated
public enum LegacyMessageOption {
PREFIX("prefix"),
SOUND("sound"),
TYPE("type"),
PAPI("papi"),
;
private final Pattern pattern;
LegacyMessageOption(@NotNull String name) {
this.pattern = Pattern.compile(name + ":(?:'|\")(.*?)(?:'|\")(?=>|\\s|$)");
}
@NotNull
public Pattern getPattern() {
return pattern;
}
}
@@ -1,86 +0,0 @@
package su.nightexpress.nightcore.language.legacy;
import org.bukkit.Sound;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import su.nightexpress.nightcore.language.message.OutputType;
import su.nightexpress.nightcore.util.NumberUtil;
import su.nightexpress.nightcore.util.Plugins;
import su.nightexpress.nightcore.util.StringUtil;
import su.nightexpress.nightcore.util.regex.TimedMatcher;
@Deprecated
public class LegacyMessageOptions {
private OutputType type;
private boolean hasPrefix;
private boolean papi;
private Sound sound;
private int[] titleTimes;
public LegacyMessageOptions() {
this.type = OutputType.CHAT;
this.hasPrefix = true;
}
@NotNull
public LegacyMessageOptions copy() {
LegacyMessageOptions copy = new LegacyMessageOptions();
copy.type = this.type;
copy.hasPrefix = this.hasPrefix;
copy.papi = this.papi;
copy.sound = this.sound;
copy.titleTimes = this.titleTimes;
return copy;
}
public void read(@NotNull String matchOptions) {
for (LegacyMessageOption option : LegacyMessageOption.values()) {
TimedMatcher matcherParam = TimedMatcher.create(option.getPattern(), matchOptions);
if (!matcherParam.find()) continue;
String optionValue = matcherParam.getMatcher().group(1).stripLeading();
switch (option) {
case TYPE -> {
String[] split = optionValue.split(":");
this.type = StringUtil.getEnum(split[0], OutputType.class).orElse(OutputType.CHAT);
if (this.type == OutputType.TITLES) {
this.titleTimes = new int[3];
if (split.length >= 4) {
this.titleTimes[0] = NumberUtil.getInteger(split[1]);
this.titleTimes[1] = NumberUtil.getAnyInteger(split[2], -1);
this.titleTimes[2] = NumberUtil.getInteger(split[3]);
}
if (this.titleTimes[1] < 0) this.titleTimes[1] = Short.MAX_VALUE;
}
}
case PREFIX -> this.hasPrefix = Boolean.parseBoolean(optionValue);
case PAPI -> this.papi = Boolean.parseBoolean(optionValue) && Plugins.hasPlaceholderAPI();
case SOUND -> this.sound = StringUtil.getEnum(optionValue, Sound.class).orElse(null);
}
}
}
@NotNull
public OutputType getType() {
return type;
}
public boolean hasPrefix() {
return this.hasPrefix;
}
public boolean hasPlaceholderAPI() {
return this.papi;
}
@Nullable
public Sound getSound() {
return sound;
}
public int[] getTitleTimes() {
return titleTimes;
}
}
@@ -10,7 +10,6 @@ import su.nightexpress.nightcore.dialog.Dialog;
import su.nightexpress.nightcore.dialog.DialogHandler;
import su.nightexpress.nightcore.language.entry.LangItem;
import su.nightexpress.nightcore.language.entry.LangString;
import su.nightexpress.nightcore.language.legacy.LegacyLangString;
import su.nightexpress.nightcore.menu.MenuViewer;
import su.nightexpress.nightcore.menu.item.ItemHandler;
import su.nightexpress.nightcore.menu.item.MenuItem;
@@ -85,16 +84,6 @@ public abstract class EditorMenu<P extends NightCorePlugin, T> extends AbstractM
return menuItem;
}
@Deprecated
public void handleInput(@NotNull MenuViewer viewer, @NotNull LegacyLangString prompt, @NotNull DialogHandler handler) {
this.handleInput(viewer.getPlayer(), prompt, handler);
}
@Deprecated
public void handleInput(@NotNull Player player, @NotNull LegacyLangString prompt, @NotNull DialogHandler handler) {
this.handleInput(player, prompt.getString(), handler);
}
@NotNull
public Dialog handleInput(@NotNull MenuViewer viewer, @NotNull LangString prompt, @NotNull DialogHandler handler) {
return this.handleInput(viewer.getPlayer(), prompt, handler);
@@ -1,29 +0,0 @@
package su.nightexpress.nightcore.util;
@Deprecated
public class Colors {
public static final String BOLD = "&l";
public static final String WHITE = "#e8f2f2";
public static final String GRAY = "#aaa8a8";
public static final String GREEN = "#74ea31";
public static final String YELLOW = "#ead931";
public static final String ORANGE = "#ea9631";
public static final String RED = "#ea3131";
public static final String BLUE = "#3196ea";
public static final String CYAN = "#31eace";
public static final String PURPLE = "#bd31ea";
public static final String PINK = "#ea31b2";
public static final String DARK_GRAY = "#6c6c62";
public static final String LIGHT_GRAY = "#d4d9d8";
public static final String LIGHT_GREEN = "#aefd5e";
public static final String LIGHT_YELLOW = "#ffeea2";
public static final String LIGHT_ORANGE = "#fdba5e";
public static final String LIGHT_RED = "#fd5e5e";
public static final String LIGHT_BLUE = "#5e9dfd";
public static final String LIGHT_CYAN = "#5edefd";
public static final String LIGHT_PURPLE = "#e39fff";
public static final String LIGHT_PINK = "#fd8ddb";
}
@@ -41,6 +41,12 @@ public class NumberUtil {
return CoreConfig.NUMBER_FORMAT.get().format(value);
}
@NotNull
public static String compact(double value) {
Pair<String, String> pair = formatCompact(value);
return pair.getFirst() + pair.getSecond();
}
@NotNull
public static Pair<String, String> formatCompact(double value) {
boolean negative = false;
@@ -133,7 +133,7 @@ public class Players {
@Deprecated
public static void sendRichMessage(@NotNull CommandSender sender, @NotNull String message) {
if (!(sender instanceof Player player)) {
if (!(sender instanceof Player)) {
sender.sendMessage(Colorizer.apply(NexParser.toPlainText(message)));
return;
}
@@ -38,7 +38,7 @@ public class NightMessage {
registerTags(Tags.BOLD, Tags.ITALIC, Tags.OBFUSCATED, Tags.STRIKETHROUGH, Tags.UNDERLINED);
registerTags(
Tags.FONT, Tags.HEX_COLOR, Tags.GRADIENT,
Tags.FONT, Tags.HEX_COLOR, Tags.HEX_COLOR_SHORT, Tags.GRADIENT,
Tags.HOVER, Tags.CLICK,
Tags.LINE_BREAK, Tags.RESET
);
@@ -0,0 +1,21 @@
package su.nightexpress.nightcore.util.text.decoration;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import org.jetbrains.annotations.NotNull;
import java.awt.*;
public class ColorDecorator implements Decorator {
private final Color color;
public ColorDecorator(@NotNull Color color) {
this.color = color;
}
@Override
public void decorate(@NotNull BaseComponent component) {
component.setColor(ChatColor.of(this.color));
}
}
@@ -1,27 +0,0 @@
package su.nightexpress.nightcore.util.text.tag;
@Deprecated
public class StandardTags {
/*public static final String WHITE = Tags.WHITE.getFullName();
public static final String GRAY = Tags.GRAY.getFullName();
public static final String GREEN = Tags.GREEN.getFullName();
public static final String YELLOW = Tags.YELLOW.getFullName();
public static final String ORANGE = Tags.ORANGE.getFullName();
public static final String RED = Tags.RED.getFullName();
public static final String BLUE = Tags.BLUE.getFullName();
public static final String CYAN = Tags.CYAN.getFullName();
public static final String PURPLE = Tags.PURPLE.getFullName();
public static final String PINK = Tags.PINK.getFullName();
public static final String DARK_GRAY = Tags.DARK_GRAY.getFullName();
public static final String LIGHT_GRAY = Tags.LIGHT_GRAY.getFullName();
public static final String LIGHT_GREEN = Tags.LIGHT_GREEN.getFullName();
public static final String LIGHT_YELLOW = Tags.LIGHT_YELLOW.getFullName();
public static final String LIGHT_ORANGE = Tags.LIGHT_ORANGE.getFullName();
public static final String LIGHT_RED = Tags.LIGHT_RED.getFullName();
public static final String LIGHT_BLUE = Tags.LIGHT_BLUE.getFullName();
public static final String LIGHT_CYAN = Tags.LIGHT_CYAN.getFullName();
public static final String LIGHT_PURPLE = Tags.LIGHT_PURPLE.getFullName();
public static final String LIGHT_PINK = Tags.LIGHT_PINK.getFullName();*/
}
@@ -4,13 +4,14 @@ import su.nightexpress.nightcore.util.text.tag.impl.*;
public class Tags {
public static final ClickTag CLICK = new ClickTag();
public static final FontTag FONT = new FontTag();
public static final GradientTag GRADIENT = new GradientTag();
public static final HexColorTag HEX_COLOR = new HexColorTag();
public static final HoverTag HOVER = new HoverTag();
public static final LineBreakTag LINE_BREAK = new LineBreakTag();
public static final ResetTag RESET = new ResetTag();
public static final ClickTag CLICK = new ClickTag();
public static final FontTag FONT = new FontTag();
public static final GradientTag GRADIENT = new GradientTag();
public static final HexColorTag HEX_COLOR = new HexColorTag();
public static final ShortHexColorTag HEX_COLOR_SHORT = new ShortHexColorTag();
public static final HoverTag HOVER = new HoverTag();
public static final LineBreakTag LINE_BREAK = new LineBreakTag();
public static final ResetTag RESET = new ResetTag();
public static final FontStyleTag BOLD = new FontStyleTag("b", FontStyleTag.Style.BOLD);
public static final FontStyleTag ITALIC = new FontStyleTag("i", FontStyleTag.Style.ITALIC);
@@ -24,7 +24,7 @@ public class GradientTag extends Tag implements DecoratorParser {
@Override
public boolean conflictsWith(@NotNull Tag tag) {
return super.conflictsWith(tag) || tag instanceof ColorTag || tag instanceof HexColorTag;
return super.conflictsWith(tag) || tag instanceof ColorTag || tag instanceof ShortHexColorTag || tag instanceof HexColorTag;
}
@Override
@@ -55,6 +55,6 @@ public class GradientTag extends Tag implements DecoratorParser {
GradientDecorator decorator = new GradientDecorator(from, to);
return new ParsedDecorator(decorator, 15 + tagLength);
return new ParsedDecorator(decorator, 15 + tagLength); // x2 hex (7+7), +1 for semicolon between
}
}
@@ -2,16 +2,17 @@ package su.nightexpress.nightcore.util.text.tag.impl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import su.nightexpress.nightcore.util.text.decoration.DecoratorParser;
import su.nightexpress.nightcore.util.text.decoration.ParsedDecorator;
import su.nightexpress.nightcore.util.text.decoration.*;
import su.nightexpress.nightcore.util.text.tag.api.Tag;
import java.awt.*;
public class HexColorTag extends Tag implements DecoratorParser {
public static final String NAME = "color";
public HexColorTag() {
super("#");
super(NAME);
}
@Override
@@ -21,21 +22,23 @@ public class HexColorTag extends Tag implements DecoratorParser {
@Override
public boolean conflictsWith(@NotNull Tag tag) {
return super.conflictsWith(tag) || tag instanceof ColorTag || tag instanceof GradientTag;
return tag instanceof ColorTag || tag instanceof HexColorTag;
}
@Override
@Nullable
public ParsedDecorator parse(@NotNull String content) {
Color color;
int tagLength = this.getName().length() + 1; // 1 for semicolon
content = content.substring(tagLength);
try {
color = Color.decode(content);
Color color = Color.decode(content);
ColorDecorator decorator = new ColorDecorator(color);
return new ParsedDecorator(decorator, 7 + tagLength);
}
catch (NumberFormatException exception) {
return null;
}
return new ParsedDecorator(new ColorTag(color), 7);
}
}
@@ -0,0 +1,42 @@
package su.nightexpress.nightcore.util.text.tag.impl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import su.nightexpress.nightcore.util.text.decoration.DecoratorParser;
import su.nightexpress.nightcore.util.text.decoration.ParsedDecorator;
import su.nightexpress.nightcore.util.text.tag.api.Tag;
import java.awt.*;
@Deprecated
public class ShortHexColorTag extends Tag implements DecoratorParser {
public ShortHexColorTag() {
super("#");
}
@Override
public int getWeight() {
return 10;
}
@Override
public boolean conflictsWith(@NotNull Tag tag) {
return super.conflictsWith(tag) || tag instanceof ColorTag || tag instanceof GradientTag;
}
@Override
@Nullable
public ParsedDecorator parse(@NotNull String content) {
Color color;
try {
color = Color.decode(content);
}
catch (NumberFormatException exception) {
return null;
}
return new ParsedDecorator(new ColorTag(color), 7);
}
}