Add PrototypeLoader.loadedVersion
Add RegionLoader.loadedVersion
Dieser Commit ist enthalten in:
Ursprung
23fdcd132a
Commit
ccf1e21287
@ -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);
|
||||
|
@ -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))) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
@version(1)
|
||||
wg{
|
||||
displayName(WarGear)
|
||||
schematic(sections4/WGArena.schem)
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
@version(1)
|
||||
wg11{
|
||||
minX(-188)
|
||||
minY(1)
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren