SteamWar/BauSystem2.0
Archiviert
12
0

Merge remote-tracking branch 'origin/master'

Dieser Commit ist enthalten in:
Chaoscaot 2021-04-18 16:10:04 +02:00
Commit 1714cbc31f
4 geänderte Dateien mit 103 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -19,12 +19,15 @@
package de.steamwar.bausystem.region; package de.steamwar.bausystem.region;
import lombok.Getter;
import yapion.hierarchy.types.YAPIONObject; import yapion.hierarchy.types.YAPIONObject;
import yapion.hierarchy.types.YAPIONType;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Getter
public class Prototype { public class Prototype {
private static final Map<String, Prototype> PROTOTYPE_MAP = new HashMap<>(); private static final Map<String, Prototype> PROTOTYPE_MAP = new HashMap<>();
@ -41,8 +44,8 @@ public class Prototype {
private final int floorOffset; private final int floorOffset;
private final int waterOffset; private final int waterOffset;
private final SubPrototype testblock; private final SubPrototype testblock; // Nullable
private final SubPrototype build; private final SubPrototype build; // Nullable
public Prototype(String name, YAPIONObject yapionObject) { public Prototype(String name, YAPIONObject yapionObject) {
PROTOTYPE_MAP.put(name, this); PROTOTYPE_MAP.put(name, this);
@ -59,10 +62,19 @@ public class Prototype {
floorOffset = yapionObject.getPlainValueOrDefault("floorOffset", 0); floorOffset = yapionObject.getPlainValueOrDefault("floorOffset", 0);
waterOffset = yapionObject.getPlainValueOrDefault("waterOffset", 0); waterOffset = yapionObject.getPlainValueOrDefault("waterOffset", 0);
testblock = new SubPrototype(yapionObject.getObject("testblock")); if (yapionObject.hasValue("testblock", YAPIONType.OBJECT)) {
build = new SubPrototype(yapionObject.getObject("build")); testblock = new SubPrototype(yapionObject.getObject("testblock"));
} else {
testblock = null;
}
if (yapionObject.hasValue("build", YAPIONType.OBJECT)) {
build = new SubPrototype(yapionObject.getObject("build"));
} else {
build = null;
}
} }
@Getter
public static class SubPrototype { public static class SubPrototype {
private final int offsetX; private final int offsetX;
@ -73,7 +85,7 @@ public class Prototype {
private final int sizeY; private final int sizeY;
private final int sizeZ; private final int sizeZ;
private final File schematicFile; private final File schematicFile; // Nullable
private final int extensionNegativeX; private final int extensionNegativeX;
private final int extensionPositiveX; private final int extensionPositiveX;
@ -91,7 +103,11 @@ public class Prototype {
sizeY = yapionObject.getPlainValue("sizeY"); sizeY = yapionObject.getPlainValue("sizeY");
sizeZ = yapionObject.getPlainValue("sizeZ"); sizeZ = yapionObject.getPlainValue("sizeZ");
schematicFile = new File(yapionObject.getValue("schematic", String.class).get()); if (yapionObject.hasValue("schematic", String.class)) {
schematicFile = new File(yapionObject.getValue("schematic", String.class).get());
} else {
schematicFile = null;
}
if (yapionObject.hasValue("extensionX", Integer.class)) { if (yapionObject.hasValue("extensionX", Integer.class)) {
extensionNegativeX = yapionObject.getPlainValue("extensionX"); extensionNegativeX = yapionObject.getPlainValue("extensionX");
@ -119,7 +135,7 @@ public class Prototype {
} }
} }
public Region generateRegion() { public static Region generateRegion(YAPIONObject regionConfig, YAPIONObject regionData) {
return null; return null;
} }

Datei anzeigen

@ -19,5 +19,33 @@
package de.steamwar.bausystem.region; package de.steamwar.bausystem.region;
import lombok.Getter;
import java.util.Set;
@Getter
public class Region { public class Region {
private Prototype prototype;
private Set<Prototype> alternativePrototypes;
private Point minPoint;
private Point maxPoint;
private Point minPointTestblock;
private Point maxPointTestblock;
private Point minPointTestblockExtension;
private Point maxPointTestblockExtension;
private Point minPointBuild;
private Point maxPointBuild;
private Point minPointBuildExtension;
private Point maxPointBuildExtension;
private Region linkedRegion = null; // Nullable
private FlagStorage flagStorage;
} }

Datei anzeigen

@ -0,0 +1,26 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.region.loader;
import lombok.experimental.UtilityClass;
@UtilityClass
public class PrototypeLoader {
}

Datei anzeigen

@ -0,0 +1,26 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.region.loader;
import lombok.experimental.UtilityClass;
@UtilityClass
public class RegionLoader {
}