From 46ae6afe3b8a1221a91e28643f5add2300665910 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 1 Dec 2021 20:18:18 +0100 Subject: [PATCH] Fix Region Signed-off-by: yoyosource --- .../src/de/steamwar/bausystem/region/Region.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java index c8cc81ba..71a74be5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java @@ -129,12 +129,20 @@ public class Region { } }); } + if (regionConfig.containsKey("prototype")) { + prototypes.add(regionConfig.getPlainValue("prototype")); + } + this.flagStorage = flagStorage; Point point = null; if (regionConfig.containsKey("minX", Integer.class) && regionConfig.containsKey("minY", Integer.class) && regionConfig.containsKey("minZ", Integer.class)) { point = new Point(regionConfig.getPlainValue("minX"), regionConfig.getPlainValue("minY"), regionConfig.getPlainValue("minZ")); } - generatePrototypeData(prototype, point); + if (prototype != null && prototypes.contains(prototype.getName())) { + generatePrototypeData(prototype, point); + } else if (regionConfig.containsKey("prototype")) { + generatePrototypeData(Prototype.getByName(regionConfig.getPlainValue("prototype")), point); + } if (!hasType(RegionType.BUILD) || !hasType(RegionType.TESTBLOCK)) { flagStorage.set(Flag.TNT, TNTMode.DENY); @@ -283,7 +291,7 @@ public class Region { } public boolean setPrototype(@NonNull Prototype prototype) { - if (!prototypes.contains(prototype.getName()) && !prototypes.isEmpty()) { + if (!prototypes.contains(prototype.getName())) { return false; } return _setPrototype(prototype); @@ -292,10 +300,6 @@ public class Region { boolean _setPrototype(@NonNull Prototype prototype) { generatePrototypeData(prototype, minPoint); RegionUtils.save(this); - setLinkedRegion(region -> { - region.generatePrototypeData(prototype, region.minPoint); - return true; - }); return true; }