Skip to content

Commit 3307989

Browse files
committed
Attempt to add better support for untranslated RGB codes in meta
1 parent 732ae5e commit 3307989

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

multichat/src/main/java/xyz/olivermartin/multichat/local/spigot/LocalSpigotMetaManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public String getPrefix(UUID uuid) {
2828
return MultiChatUtil.approximateHexCodes(vaultChat.getPlayerPrefix(Bukkit.getServer().getPlayer(uuid)));
2929
}
3030

31-
return vaultChat.getPlayerPrefix(Bukkit.getServer().getPlayer(uuid));
31+
return MultiChatUtil.reformatRGB(vaultChat.getPlayerPrefix(Bukkit.getServer().getPlayer(uuid)));
3232

3333
}
3434

@@ -50,7 +50,7 @@ public String getSuffix(UUID uuid) {
5050
return MultiChatUtil.approximateHexCodes(vaultChat.getPlayerSuffix(Bukkit.getServer().getPlayer(uuid)));
5151
}
5252

53-
return vaultChat.getPlayerSuffix(Bukkit.getServer().getPlayer(uuid));
53+
return MultiChatUtil.reformatRGB(vaultChat.getPlayerSuffix(Bukkit.getServer().getPlayer(uuid)));
5454

5555
}
5656

@@ -86,6 +86,7 @@ public String getDisplayName(UUID uuid) {
8686
displayNameFormat = displayNameFormat.replaceAll("%NAME%", player.getName());
8787
displayNameFormat = displayNameFormat.replaceAll("%PREFIX%", getPrefix(uuid));
8888
displayNameFormat = displayNameFormat.replaceAll("%SUFFIX%", getSuffix(uuid));
89+
displayNameFormat = MultiChatUtil.reformatRGB(displayNameFormat);
8990
displayNameFormat = displayNameFormat.replaceAll("&(?=[a-f,0-9,k-o,r,x])", "§");
9091

9192
// LEGACY HACK

multichat/src/main/java/xyz/olivermartin/multichat/local/sponge/LocalSpongeMetaManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public String getPrefix(UUID uuid) {
2424
Player player = opPlayer.get();
2525

2626
if (player.getOption("prefix").isPresent()) {
27-
return MultiChatUtil.approximateHexCodes(player.getOption("prefix").get());
27+
return MultiChatUtil.approximateHexCodes(MultiChatUtil.reformatRGB(player.getOption("prefix").get()));
2828
} else {
2929
return "";
3030
}
@@ -45,7 +45,7 @@ public String getSuffix(UUID uuid) {
4545
Player player = opPlayer.get();
4646

4747
if (player.getOption("suffix").isPresent()) {
48-
return MultiChatUtil.approximateHexCodes(player.getOption("suffix").get());
48+
return MultiChatUtil.approximateHexCodes(MultiChatUtil.reformatRGB(player.getOption("suffix").get()));
4949
} else {
5050
return "";
5151
}
@@ -92,8 +92,9 @@ public String getDisplayName(UUID uuid) {
9292
displayNameFormat = displayNameFormat.replaceAll("%NAME%", player.getName());
9393
displayNameFormat = displayNameFormat.replaceAll("%PREFIX%", getPrefix(uuid));
9494
displayNameFormat = displayNameFormat.replaceAll("%SUFFIX%", getSuffix(uuid));
95+
displayNameFormat = MultiChatUtil.reformatRGB(displayNameFormat);
9596
displayNameFormat = displayNameFormat.replaceAll("&(?=[a-f,0-9,k-o,r,x])", "§");
96-
97+
9798
displayNameFormat = MultiChatUtil.approximateHexCodes(displayNameFormat);
9899

99100
// TODO Sponge doesn't seem to like this... So we tend to work around it by sending back our original string

0 commit comments

Comments
 (0)