diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/Prototype.java b/BauSystem_Main/src/de/steamwar/bausystem/region/Prototype.java index 2d627547..119fb49e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/Prototype.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/Prototype.java @@ -19,11 +19,9 @@ package de.steamwar.bausystem.region; -import de.steamwar.bausystem.region.flags.Flag; import lombok.Getter; import yapion.hierarchy.types.YAPIONObject; import yapion.hierarchy.types.YAPIONType; -import yapion.serializing.YAPIONDeserializer; import java.io.File; import java.util.HashMap; @@ -82,7 +80,9 @@ public class Prototype { } if (PROTOTYPE_MAP.containsKey(name)) { - Region.getRegion(PROTOTYPE_MAP.remove(name)).forEach(region -> region.setPrototype(this)); + Region.getRegion(PROTOTYPE_MAP.remove(name)).forEach(region -> { + region.setPrototype(this); + }); } PROTOTYPE_MAP.put(name, this); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java index aeea678b..b8478b6c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java @@ -37,7 +37,10 @@ import yapion.hierarchy.types.YAPIONValue; import java.io.File; import java.io.IOException; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -69,7 +72,7 @@ public class Region { private String name; private Prototype prototype; - private Set prototypes; + private Set prototypes; private Point minPoint; private Point maxPoint; @@ -115,7 +118,7 @@ public class Region { if (regionConfig.containsKey("prototypes", YAPIONType.ARRAY)) { regionConfig.getArray("prototypes").forEach(yapionAnyType -> { if (yapionAnyType instanceof YAPIONValue) { - prototypes.add(Prototype.PROTOTYPE_MAP.get(((YAPIONValue) yapionAnyType).get())); + prototypes.add(((YAPIONValue) yapionAnyType).get()); } }); } @@ -136,9 +139,6 @@ public class Region { return; } - if (this.prototype != null && !prototypes.contains(prototype)) { - return; - } this.prototype = prototype; this.minPoint = point; @@ -259,10 +259,7 @@ public class Region { } public void setPrototype(@NonNull Prototype prototype) { - if (this.prototype == null) { - return; - } - if (!prototypes.contains(prototype)) { + if (!prototypes.contains(prototype.getName()) && !prototypes.isEmpty()) { return; } generatePrototypeData(prototype, minPoint);