mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-03 23:17:48 +01:00
Merge pull request #65 from KrystilizeNevaDies/master
Fix rgb byte overflow
This commit is contained in:
commit
3c3230ae1e
@ -263,19 +263,9 @@ public class ChatColor {
|
|||||||
code = codeName;
|
code = codeName;
|
||||||
} else {
|
} else {
|
||||||
// RGB color
|
// RGB color
|
||||||
String redH = Integer.toHexString(red);
|
int color = (red & 0xFF) << 16 | (green & 0xFF) << 8 | blue & 0xFF;
|
||||||
if (redH.length() == 1)
|
|
||||||
redH = "0" + redH;
|
|
||||||
|
|
||||||
String greenH = Integer.toHexString(green);
|
code = "#"+Integer.toHexString(color);
|
||||||
if (greenH.length() == 1)
|
|
||||||
greenH = "0" + greenH;
|
|
||||||
|
|
||||||
String blueH = Integer.toHexString(blue);
|
|
||||||
if (blueH.length() == 1)
|
|
||||||
blueH = "0" + blueH;
|
|
||||||
|
|
||||||
code = redH + greenH + blueH;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return header + code + footer;
|
return header + code + footer;
|
||||||
|
Loading…
Reference in New Issue
Block a user