mirror of
https://github.com/NEZNAMY/TAB.git
synced 2026-11-26 10:29:49 -05:00
fixed missing colors on 1.16 clients due to viaversion blocking it
This commit is contained in:
1 parent
c07732e115
commit
ee8bef0631
2 files changed
+11
No files matched your search
@@ -73,4 +73,10 @@ public enum EnumChatFormat{
|
||||
public String getFormat() {
|
||||
return Placeholders.colorChar + "" + character;
|
||||
}
|
||||
public static EnumChatFormat fromRGBExact(int red, int green, int blue){
|
||||
for (EnumChatFormat format : values()) {
|
||||
if (format.red == red && format.green == green && format.blue == blue) return format;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -403,6 +403,11 @@ public class IChatBaseComponent {
|
||||
}
|
||||
public String toString(ProtocolVersion clientVersion) {
|
||||
if (clientVersion.getMinorVersion() >= 16) {
|
||||
EnumChatFormat legacyEquivalent = EnumChatFormat.fromRGBExact(red, green, blue);
|
||||
if (legacyEquivalent != null) {
|
||||
//not sending old colors as RGB to 1.16 clients if not needed, also viaversion blocks that as well
|
||||
return legacyEquivalent.toString().toLowerCase();
|
||||
}
|
||||
return "#" + Integer.toHexString((red << 16) + (green << 8) + blue);
|
||||
} else {
|
||||
return legacy.toString().toLowerCase();
|
||||
|
||||
Reference in new issue
Block a user