mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-24 21:54:33 +01:00
Fixed exception when encountering unknown traits whilst loading from json
This commit is contained in:
parent
aed4efcbbe
commit
0beaaa4603
1 changed files with 1 additions and 1 deletions
|
@ -201,7 +201,7 @@ public final class SpellTraits implements Iterable<Map.Entry<Trait, Float>> {
|
||||||
public static Stream<Map.Entry<Trait, Float>> streamFromJson(JsonObject traits) {
|
public static Stream<Map.Entry<Trait, Float>> streamFromJson(JsonObject traits) {
|
||||||
return traits.entrySet().stream().map(entry -> {
|
return traits.entrySet().stream().map(entry -> {
|
||||||
Trait trait = Trait.REGISTRY.get(entry.getKey().toUpperCase());
|
Trait trait = Trait.REGISTRY.get(entry.getKey().toUpperCase());
|
||||||
if (trait == null && !entry.getValue().isJsonPrimitive() && !entry.getValue().getAsJsonPrimitive().isNumber()) {
|
if (trait == null || !entry.getValue().isJsonPrimitive() && !entry.getValue().getAsJsonPrimitive().isNumber()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Map.entry(trait, entry.getValue().getAsJsonPrimitive().getAsFloat());
|
return Map.entry(trait, entry.getValue().getAsJsonPrimitive().getAsFloat());
|
||||||
|
|
Loading…
Reference in a new issue