From 5bf771c1ceaaafa5d37ca3e9438536dd5163adc2 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 5 Apr 2021 14:31:47 +0200 Subject: [PATCH] Add save/load GlobalRegion options --- .../bausystem/world/regions/Region.java | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) 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 bdc95de..a02edfb 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Region.java @@ -141,6 +141,24 @@ public class Region { private Region(ConfigurationSection config) { name = config.getName(); + minPoint = new Point(config.getInt("minX"), config.getInt("minY"), config.getInt("minZ")); + prototype = Prototype.prototypes.get(config.getString("prototype")); + optionsLinkedWith = config.getString("optionsLinkedWith", null); + if (!hasTestblock()) tntMode = TNTMode.OFF; + regions.add(this); + load(); + } + + public Region(String name) { + this.name = name; + this.minPoint = new Point(0, 0, 0); + this.prototype = null; + this.optionsLinkedWith = null; + tntMode = TNTMode.OFF; + load(); + } + + private void load() { if (regionsObject.has(name)) { regionOptions = regionsObject.getAsJsonObject(name); if (regionOptions.has("tnt")) { @@ -171,20 +189,6 @@ public class Region { } else { regionsObject.add(name, regionOptions); } - - minPoint = new Point(config.getInt("minX"), config.getInt("minY"), config.getInt("minZ")); - prototype = Prototype.prototypes.get(config.getString("prototype")); - optionsLinkedWith = config.getString("optionsLinkedWith", null); - if (!hasTestblock()) tntMode = TNTMode.OFF; - regions.add(this); - } - - public Region(String name) { - this.name = name; - this.minPoint = new Point(0, 0, 0); - this.prototype = null; - this.optionsLinkedWith = null; - tntMode = TNTMode.OFF; } public Color getColor() {