forked from SteamWar/SteamWar
Fix YMLWrapper
This commit is contained in:
@@ -50,5 +50,6 @@ tasks.register<DevServer>("DevBau21") {
|
|||||||
description = "Run a 1.21 Dev Bau"
|
description = "Run a 1.21 Dev Bau"
|
||||||
dependsOn(":SpigotCore:shadowJar")
|
dependsOn(":SpigotCore:shadowJar")
|
||||||
dependsOn(":BauSystem:shadowJar")
|
dependsOn(":BauSystem:shadowJar")
|
||||||
|
dependsOn(":SchematicSystem:shadowJar")
|
||||||
template = "Bau21"
|
template = "Bau21"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,15 @@ final class YMLWrapper<M, W> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getDouble(String path, double defaultValue) {
|
public double getDouble(String path, double defaultValue) {
|
||||||
return get(path, defaultValue, Double.class::cast);
|
return get(path, defaultValue, o -> {
|
||||||
|
if (o instanceof Integer) {
|
||||||
|
return (Double) (double) (Integer) o;
|
||||||
|
} else if (o instanceof Double) {
|
||||||
|
return (Double) o;
|
||||||
|
} else {
|
||||||
|
throw new ClassCastException(o + " is not a double or integer");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getBoolean(String path, boolean defaultValue) {
|
public boolean getBoolean(String path, boolean defaultValue) {
|
||||||
|
|||||||
Reference in New Issue
Block a user