mirror of
https://github.com/BlueMap-Minecraft/BlueMapAPI.git
synced 2024-11-14 14:25:18 +01:00
Use the original value in the error
This commit is contained in:
parent
f9bbdc3d38
commit
1d0d63f088
@ -128,7 +128,8 @@ public float getAlpha() {
|
||||
return a;
|
||||
}
|
||||
|
||||
private static int parseColorString(String val) {
|
||||
private static int parseColorString(String value) {
|
||||
String val = value;
|
||||
if (val.charAt(0) == '#') {
|
||||
val = val.substring(1);
|
||||
if (val.length() == 3) val = val + "f";
|
||||
@ -136,7 +137,7 @@ private static int parseColorString(String val) {
|
||||
val.charAt(0) + val.charAt(0) + val.charAt(1) + val.charAt(1) +
|
||||
val.charAt(2) + val.charAt(2) + val.charAt(3) + val.charAt(3);
|
||||
if (val.length() == 6) val = val + "ff";
|
||||
if (val.length() != 8) throw new NumberFormatException("Invalid color format: '" + val + "'!");
|
||||
if (val.length() != 8) throw new NumberFormatException("Invalid color format: '" + value + "'!");
|
||||
val = val.substring(6, 8) + val.substring(0, 6); // move alpha to front
|
||||
return Integer.parseUnsignedInt(val, 16);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user