mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-09-29 23:57:35 +02:00
Use the original value in the error
This commit is contained in:
parent
8b16805515
commit
7d263c8b7f
@ -1 +1 @@
|
|||||||
Subproject commit f9bbdc3d38405f59a82f427b868d6d5f7545738e
|
Subproject commit 1d0d63f08853581a447f818fbacc7e5c14aa514e
|
@ -170,13 +170,14 @@ public Color straight() {
|
|||||||
* @return The parsed Integer
|
* @return The parsed Integer
|
||||||
* @throws NumberFormatException If the value is not formatted correctly or if there is no value present.
|
* @throws NumberFormatException If the value is not formatted correctly or if there is no value present.
|
||||||
*/
|
*/
|
||||||
public Color parse(String val) {
|
public Color parse(String value) {
|
||||||
|
String val = value;
|
||||||
if (val.charAt(0) == '#') {
|
if (val.charAt(0) == '#') {
|
||||||
val = val.substring(1);
|
val = val.substring(1);
|
||||||
if (val.length() == 3) val = val + "f";
|
if (val.length() == 3) val = val + "f";
|
||||||
if (val.length() == 4) 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() == 4) 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() == 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
|
val = val.substring(6, 8) + val.substring(0, 6); // move alpha to front
|
||||||
return set(Integer.parseUnsignedInt(val, 16));
|
return set(Integer.parseUnsignedInt(val, 16));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user