Make loading RGB colors easier

This commit is contained in:
Sn0wStorm
2019-08-17 22:42:58 +02:00
parent c39b35d82a
commit 9567feed81
7 changed files with 34 additions and 12 deletions
+6 -3
View File
@@ -766,10 +766,13 @@ public class Brew {
case "BRIGHT_GREY": return BRIGHT_GREY;
default:
try{
if (string.length() >= 7) {
string = string.substring(1);
}
return new PotionColor(Color.fromRGB(
Integer.parseInt(string.substring( 1, 3 ), 16 ),
Integer.parseInt(string.substring( 3, 5 ), 16 ),
Integer.parseInt(string.substring( 5, 7 ), 16 )
Integer.parseInt(string.substring( 0, 2 ), 16 ),
Integer.parseInt(string.substring( 2, 4 ), 16 ),
Integer.parseInt(string.substring( 4, 6 ), 16 )
));
} catch (Exception e) {
return WATER;