Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Better flexibility with number loading
Dieser Commit ist enthalten in:
Ursprung
689f0fd5db
Commit
eb78fe4bfc
@ -145,7 +145,11 @@ public abstract class Config implements ConfigurationProvider {
|
|||||||
|
|
||||||
public int getInt(String key, int def) {
|
public int getInt(String key, int def) {
|
||||||
if (this.config.containsKey(key)) {
|
if (this.config.containsKey(key)) {
|
||||||
return (int) this.config.get(key);
|
if (this.config.get(key) instanceof Number) {
|
||||||
|
return ((Number) this.config.get(key)).intValue();
|
||||||
|
} else {
|
||||||
|
return def;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
@ -153,7 +157,11 @@ public abstract class Config implements ConfigurationProvider {
|
|||||||
|
|
||||||
public double getDouble(String key, double def) {
|
public double getDouble(String key, double def) {
|
||||||
if (this.config.containsKey(key)) {
|
if (this.config.containsKey(key)) {
|
||||||
return (double) this.config.get(key);
|
if (this.config.get(key) instanceof Number) {
|
||||||
|
return ((Number) this.config.get(key)).doubleValue();
|
||||||
|
} else {
|
||||||
|
return def;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren