diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Region.java index a02edfb..723587d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Region.java @@ -29,6 +29,7 @@ import de.steamwar.bausystem.world.Color; import de.steamwar.bausystem.world.SizedStack; import de.steamwar.sql.NoClipboardException; import de.steamwar.sql.Schematic; +import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.configuration.ConfigurationSection; @@ -133,10 +134,19 @@ public class Region { private JsonObject regionOptions = new JsonObject(); + @Getter private TNTMode tntMode = Region.buildAreaEnabled() ? TNTMode.ONLY_TB : TNTMode.OFF; + + @Getter private boolean freeze = false; + + @Getter private boolean fire = false; + @Getter + private boolean protect = false; + + @Getter private Color color = Color.YELLOW; private Region(ConfigurationSection config) { @@ -178,6 +188,10 @@ public class Region { freeze = regionOptions.getAsJsonPrimitive("freeze").getAsBoolean(); } + if (regionOptions.has("protect")) { + protect = regionOptions.getAsJsonPrimitive("protect").getAsBoolean(); + } + if (regionOptions.has("color")) { String colorName = regionOptions.getAsJsonPrimitive("color").getAsString(); try { @@ -191,10 +205,6 @@ public class Region { } } - public Color getColor() { - return color; - } - public void setColor(Color color) { this.color = color; regionOptions.add("color", new JsonPrimitive(color.name())); @@ -217,36 +227,42 @@ public class Region { } } - public TNTMode getTntMode() { - return tntMode; - } - public void setTntMode(TNTMode tntMode) { this.tntMode = tntMode; - setLinkedRegion(region -> region.tntMode = tntMode); + setLinkedRegion(region -> { + region.tntMode = tntMode; + region.regionOptions.add("tnt", new JsonPrimitive(tntMode.name())); + }); regionOptions.add("tnt", new JsonPrimitive(tntMode.name())); } - public boolean isFreeze() { - return freeze; - } - public void setFreeze(boolean freeze) { this.freeze = freeze; - setLinkedRegion(region -> region.freeze = freeze); + setLinkedRegion(region -> { + region.freeze = freeze; + region.regionOptions.add("freeze", new JsonPrimitive(freeze)); + }); regionOptions.add("freeze", new JsonPrimitive(freeze)); } - public boolean isFire() { - return fire; - } - public void setFire(boolean fire) { this.fire = fire; - setLinkedRegion(region -> region.fire = fire); + setLinkedRegion(region -> { + region.fire = fire; + region.regionOptions.add("fire", new JsonPrimitive(fire)); + }); regionOptions.add("fire", new JsonPrimitive(fire)); } + public void setProtect(boolean protect) { + this.protect = protect; + setLinkedRegion(region -> { + region.protect = protect; + region.regionOptions.add("protect", new JsonPrimitive(protect)); + }); + regionOptions.add("protect", new JsonPrimitive(protect)); + } + public Point getMinPoint(RegionType regionType, RegionExtensionType regionExtensionType) { switch (regionType) { case BUILD: