mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Convert tags automatically when loading them in to avoid errors
This commit is contained in:
parent
f474ce99fd
commit
773805101b
@ -53,7 +53,14 @@ public class PlayerData
|
||||
ips.addAll(FUtil.stringToList(resultSet.getString("ips")));
|
||||
notes.clear();
|
||||
notes.addAll(FUtil.stringToList(resultSet.getString("notes")));
|
||||
tag = FUtil.miniMessage(resultSet.getString("tag"));
|
||||
String tempTag = resultSet.getString("tag");
|
||||
//--
|
||||
if (!Strings.isNullOrEmpty(tempTag) && FUtil.containsChatColor(tempTag))
|
||||
{
|
||||
tempTag = FUtil.miniMessage(FUtil.colorizeAsComponentSection(tempTag));
|
||||
}
|
||||
//--
|
||||
tag = FUtil.miniMessage(tempTag);
|
||||
discordID = resultSet.getString("discord_id");
|
||||
masterBuilder = resultSet.getBoolean("master_builder");
|
||||
rideMode = RideMode.valueOf(resultSet.getString("ride_mode").toUpperCase());
|
||||
|
@ -83,6 +83,7 @@ public class FUtil
|
||||
|
||||
private static final PlainTextComponentSerializer STEAMROLLER = PlainTextComponentSerializer.plainText();
|
||||
public static final LegacyComponentSerializer LEGACY_AMPERSAND = LegacyComponentSerializer.legacyAmpersand();
|
||||
public static final LegacyComponentSerializer LEGACY_SECTION = LegacyComponentSerializer.legacySection();
|
||||
public static final MiniMessage MINI_MESSAGE = MiniMessage.builder().tags(TagResolver.resolver(
|
||||
StandardTags.color(),
|
||||
StandardTags.rainbow(),
|
||||
@ -490,6 +491,11 @@ public class FUtil
|
||||
return LEGACY_AMPERSAND.deserialize(string);
|
||||
}
|
||||
|
||||
public static Component colorizeAsComponentSection(String string)
|
||||
{
|
||||
return LEGACY_SECTION.deserialize(string);
|
||||
}
|
||||
|
||||
public static Component miniMessage(String string, TagResolver... placeholders)
|
||||
{
|
||||
return MINI_MESSAGE.deserialize(string, placeholders);
|
||||
|
Loading…
Reference in New Issue
Block a user