diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/loader/PrototypeLoader.java b/BauSystem_Main/src/de/steamwar/bausystem/region/loader/PrototypeLoader.java index 86c79e6f..a8a0531c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/loader/PrototypeLoader.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/loader/PrototypeLoader.java @@ -33,6 +33,7 @@ import java.io.IOException; @UtilityClass public class PrototypeLoader { + private int loadedVersion = 0; public static final File file = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "prototypes.yapion"); public void load() { @@ -43,6 +44,12 @@ public class PrototypeLoader { throw new SecurityException(e.getMessage(), e); } + int currentVersion = yapionObject.getPlainValue("@version"); + if (currentVersion != loadedVersion && loadedVersion != 0) { + throw new SecurityException("Version was not the specified version needed."); + } + loadedVersion = currentVersion; + yapionObject.forEach((key, yapionAnyType) -> { if (yapionAnyType instanceof YAPIONObject) { new Prototype(key, (YAPIONObject) yapionAnyType); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/loader/RegionLoader.java b/BauSystem_Main/src/de/steamwar/bausystem/region/loader/RegionLoader.java index 198f1dfd..58f2689f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/loader/RegionLoader.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/loader/RegionLoader.java @@ -37,6 +37,7 @@ import java.io.IOException; @UtilityClass public class RegionLoader { + private int loadedVersion = 0; private YAPIONObject optionsYapionObject; public static final File file = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "regions.yapion"); @@ -56,6 +57,12 @@ public class RegionLoader { throw new SecurityException(e.getMessage(), e); } + int currentVersion = yapionObject.getPlainValue("@version"); + if (currentVersion != loadedVersion && loadedVersion != 0) { + throw new SecurityException("Version was not the specified version needed."); + } + loadedVersion = currentVersion; + File optionsFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "options.yapion"); optionsYapionObject = new YAPIONObject(); try (BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(optionsFile))) { diff --git a/yapion/prototypes.yapion b/yapion/prototypes.yapion index ad109152..57a6c33d 100644 --- a/yapion/prototypes.yapion +++ b/yapion/prototypes.yapion @@ -1,4 +1,5 @@ { + @version(1) wg{ displayName(WarGear) schematic(sections4/WGArena.schem) diff --git a/yapion/regions.yapion b/yapion/regions.yapion index 0b7019db..8a3875f9 100644 --- a/yapion/regions.yapion +++ b/yapion/regions.yapion @@ -1,4 +1,5 @@ { + @version(1) wg11{ minX(-188) minY(1)