SteamWar/BauSystem
Archiviert
13
0

Merge pull request 'Add Region.extensionArea' (#196) from ExtensionAreaBoolean into master

Reviewed-on: #196
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
YoyoNow 2021-03-05 20:15:26 +01:00
Commit f3937990ca

Datei anzeigen

@ -40,6 +40,7 @@ public class Region {
private static final List<Region> regions = new ArrayList<>();
private static boolean buildArea = false;
private static boolean extensionArea = false;
static{
YamlConfiguration config = new YamlConfiguration();
@ -66,6 +67,10 @@ public class Region {
return buildArea;
}
public static boolean extensionAreaEnabled() {
return extensionArea;
}
public static Region getRegion(Location location) {
for (Region region : regions) {
if (region.inRegion(location)) return region;
@ -190,6 +195,14 @@ public class Region {
prototype.protect(this, schem);
}
public boolean hasExtensionAreaRegistered() {
return prototype.extensionPrototypeArea;
}
public boolean hasTestblockExtensionAreaRegistered() {
return prototype.testblock.extensionPrototypeArea;
}
public static class GlobalRegion extends Region {
private static final GlobalRegion GLOBAL_REGION = new GlobalRegion();
@ -226,6 +239,15 @@ public class Region {
return false;
}
@Override
public boolean hasExtensionAreaRegistered() {
return false;
}
@Override
public boolean hasTestblockExtensionAreaRegistered() {
return false;
}
}
public static class Prototype{
@ -243,6 +265,7 @@ public class Region {
private final int extensionNegativeZ;
private final int extensionPositiveY;
private final int extensionAxisX;
private final boolean extensionPrototypeArea;
private final String schematic;
private final boolean rotate;
@ -264,6 +287,10 @@ public class Region {
extensionNegativeZ = config.getInt("extensionNegativeZ", 0);
extensionPositiveY = config.getInt("extensionPositiveY", 0);
extensionAxisX = config.getInt("extensionAxisX", 0);
if (config.contains("extensionPositiveZ") || config.contains("extensionNegativeZ") || config.contains("extensionPositiveY") || config.contains("extensionAxisX")) {
extensionArea = true;
}
extensionPrototypeArea = extensionNegativeZ != 0 || extensionPositiveZ != 0 || extensionPositiveY != 0 || extensionAxisX != 0;
rotate = config.getBoolean("rotate", false);
ConfigurationSection testblockSection = config.getConfigurationSection("testblock");