SteamWar/BauSystem
Archiviert
13
0

Add Extensions #187

Manuell gemergt
YoyoNow hat 5 Commits von Extensions nach master 2021-02-06 15:39:33 +01:00 zusammengeführt
Nur Änderungen aus Commit 7cfc8a9594 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -230,21 +230,17 @@ public class Region {
} }
public enum ExtensionDirection { public enum ExtensionDirection {
PositiveZ("positivez", "z+"), PositiveZ("positivez", "z+"),
NegativeZ("negativez", "z-"), NegativeZ("negativez", "z-"),
PositiveX("positivex", "x+"), PositiveX("positivex", "x+"),
NegativeX("negativex", "x-"); NegativeX("negativex", "x-");
private Set<String> values; private Set<String> values;
ExtensionDirection(String... values) { ExtensionDirection(String... values) {
this.values = new HashSet<>(Arrays.asList(values)); this.values = new HashSet<>(Arrays.asList(values));
} }
public static ExtensionDirection getByString(String value) { private static ExtensionDirection getByString(String value) {
if (value == null) return null;
value = value.toLowerCase();
for (ExtensionDirection extensionDirection : values()) { for (ExtensionDirection extensionDirection : values()) {
if (extensionDirection.values.contains(value)) return extensionDirection; if (extensionDirection.values.contains(value)) return extensionDirection;
} }
@ -286,7 +282,7 @@ public class Region {
offsetX = config.getInt("offsetX", 0); offsetX = config.getInt("offsetX", 0);
offsetY = config.getInt("offsetY", 0); offsetY = config.getInt("offsetY", 0);
offsetZ = config.getInt("offsetZ", 0); offsetZ = config.getInt("offsetZ", 0);
extensionFrontDirection = ExtensionDirection.getByString(config.getString("extensionFrontDirection", null)); extensionFrontDirection = ExtensionDirection.getByString(config.getString("extensionFrontDirection", "").toLowerCase());
extensionFront = config.getInt("extensionFront", 0); extensionFront = config.getInt("extensionFront", 0);
extensionBack = config.getInt("extensionBack", 0); extensionBack = config.getInt("extensionBack", 0);
extensionUp = config.getInt("extensionUp", 0); extensionUp = config.getInt("extensionUp", 0);