Use VariantSelector

This commit is contained in:
2025-08-06 11:31:28 +02:00
parent 838fa76c82
commit 53457a89d9
13 changed files with 66 additions and 65 deletions
@@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.steamwar.bausystem.region.dynamic.variants; package de.steamwar.bausystem.region.dynamic;
import lombok.NonNull; import lombok.NonNull;
@@ -52,8 +52,9 @@ public interface VariantSelector {
static VariantSelector StableVariants(@NonNull File directory) { static VariantSelector StableVariants(@NonNull File directory) {
File[] files = directory.listFiles(); File[] files = directory.listFiles();
Random rand = new Random();
return (minX, minZ) -> { return (minX, minZ) -> {
Random rand = new Random(Objects.hash(minX, minZ)); rand.setSeed(Objects.hash(minX, minZ));
return Optional.of(files[rand.nextInt(files.length)]); return Optional.of(files[rand.nextInt(files.length)]);
}; };
} }
@@ -22,6 +22,7 @@ package de.steamwar.bausystem.region.dynamic.normal;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.dynamic.VariantSelector;
import de.steamwar.bausystem.utils.PasteBuilder; import de.steamwar.bausystem.utils.PasteBuilder;
import org.bukkit.Location; import org.bukkit.Location;
@@ -30,7 +31,7 @@ import java.util.function.BiConsumer;
public abstract class NormalArea implements Region.Area { public abstract class NormalArea implements Region.Area {
public abstract NormalArea setResetFile(File resetFile); public abstract NormalArea setResetFile(VariantSelector variantSelector);
public static final NormalArea EMPTY = new NormalArea() { public static final NormalArea EMPTY = new NormalArea() {
@Override @Override
@@ -64,7 +65,7 @@ public abstract class NormalArea implements Region.Area {
} }
@Override @Override
public NormalArea setResetFile(File resetFile) { public NormalArea setResetFile(VariantSelector variantSelector) {
return this; return this;
} }
@@ -23,6 +23,7 @@ import com.sk89q.worldedit.EditSession;
import de.steamwar.bausystem.region.FlagStorage; import de.steamwar.bausystem.region.FlagStorage;
import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.dynamic.VariantSelector;
import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.utils.PasteBuilder; import de.steamwar.bausystem.utils.PasteBuilder;
import lombok.NonNull; import lombok.NonNull;
@@ -39,21 +40,21 @@ public class WorkArea extends NormalArea {
private final int widthX; private final int widthX;
private final int widthY; private final int widthY;
private final int widthZ; private final int widthZ;
private File resetFile; private VariantSelector variantSelector;
private final Point minPoint; private final Point minPoint;
private final Point maxPoint; private final Point maxPoint;
private final Point copyPoint; private final Point copyPoint;
private final boolean rotate; private final boolean rotate;
private final Region region; private final Region region;
public WorkArea(int minX, int minY, int minZ, int widthX, int widthY, int widthZ, File resetFile, boolean rotate, Region region) { public WorkArea(int minX, int minY, int minZ, int widthX, int widthY, int widthZ, VariantSelector variantSelector, boolean rotate, Region region) {
this.minX = minX; this.minX = minX;
this.minY = minY; this.minY = minY;
this.minZ = minZ; this.minZ = minZ;
this.widthX = widthX; this.widthX = widthX;
this.widthY = widthY; this.widthY = widthY;
this.widthZ = widthZ; this.widthZ = widthZ;
this.resetFile = resetFile; this.variantSelector = variantSelector;
this.rotate = rotate; this.rotate = rotate;
this.region = region; this.region = region;
@@ -78,15 +79,15 @@ public class WorkArea extends NormalArea {
} }
@Override @Override
public NormalArea setResetFile(File resetFile) { public NormalArea setResetFile(VariantSelector variantSelector) {
this.resetFile = resetFile; this.variantSelector = variantSelector;
return this; return this;
} }
@Nullable @Nullable
@Override @Override
public File getResetFile() { public File getResetFile() {
return resetFile; return variantSelector.selectVariant(minX, minZ).orElseThrow();
} }
@Override @Override
@@ -25,13 +25,12 @@ import de.steamwar.bausystem.region.RegionHistory;
import de.steamwar.bausystem.region.dynamic.DynamicRegion; import de.steamwar.bausystem.region.dynamic.DynamicRegion;
import de.steamwar.bausystem.region.dynamic.RegionConstructorData; import de.steamwar.bausystem.region.dynamic.RegionConstructorData;
import de.steamwar.bausystem.region.dynamic.RegionDataRepository; import de.steamwar.bausystem.region.dynamic.RegionDataRepository;
import de.steamwar.bausystem.region.dynamic.VariantSelector;
import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.TestblockMode; import de.steamwar.bausystem.region.flags.TestblockMode;
import lombok.Getter; import lombok.Getter;
import lombok.NonNull; import lombok.NonNull;
import java.io.File;
public abstract class WorkRegion extends DynamicRegion { public abstract class WorkRegion extends DynamicRegion {
@Getter @Getter
@@ -42,8 +41,8 @@ public abstract class WorkRegion extends DynamicRegion {
protected NormalArea northArea = NormalArea.EMPTY; protected NormalArea northArea = NormalArea.EMPTY;
protected NormalArea southArea = NormalArea.EMPTY; protected NormalArea southArea = NormalArea.EMPTY;
protected File frame; protected VariantSelector frame;
protected File testblock; protected VariantSelector testblock;
@Getter @Getter
private final RegionHistory history = new RegionHistory.Impl(20); private final RegionHistory history = new RegionHistory.Impl(20);
@@ -22,6 +22,7 @@ package de.steamwar.bausystem.region.dynamic.normal.work;
import de.steamwar.bausystem.region.GameModeConfig; import de.steamwar.bausystem.region.GameModeConfig;
import de.steamwar.bausystem.region.RegionType; import de.steamwar.bausystem.region.RegionType;
import de.steamwar.bausystem.region.dynamic.RegionConstructorData; import de.steamwar.bausystem.region.dynamic.RegionConstructorData;
import de.steamwar.bausystem.region.dynamic.VariantSelector;
import de.steamwar.bausystem.region.dynamic.normal.WorkArea; import de.steamwar.bausystem.region.dynamic.normal.WorkArea;
import de.steamwar.bausystem.region.dynamic.normal.WorkRegion; import de.steamwar.bausystem.region.dynamic.normal.WorkRegion;
import lombok.Getter; import lombok.Getter;
@@ -45,20 +46,20 @@ public class MicroWarGear21WorkRegion extends WorkRegion {
public MicroWarGear21WorkRegion(int minX, int minZ) { public MicroWarGear21WorkRegion(int minX, int minZ) {
super(minX, minZ); super(minX, minZ);
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this); area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, VariantSelector.File(REGION_FILE), false, this);
northArea = new WorkArea(minX + 25, 32, minZ + 25, 7, 7, 7, null, false, this); northArea = new WorkArea(minX + 25, 32, minZ + 25, 7, 7, 7, null, false, this);
southArea = new WorkArea(minX + 25, 32, minZ + 82, 7, 7, 7, null, true, this); southArea = new WorkArea(minX + 25, 32, minZ + 82, 7, 7, 7, null, true, this);
frame = FRAME_FILE; frame = VariantSelector.File(FRAME_FILE);
testblock = TESTBLOCK_FILE; testblock = VariantSelector.File(TESTBLOCK_FILE);
} }
public MicroWarGear21WorkRegion(RegionConstructorData regionConstructorData) { public MicroWarGear21WorkRegion(RegionConstructorData regionConstructorData) {
super(regionConstructorData); super(regionConstructorData);
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this); area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, VariantSelector.File(REGION_FILE), false, this);
northArea = new WorkArea(minX + 25, 32, minZ + 25, 7, 7, 7, null, false, this); northArea = new WorkArea(minX + 25, 32, minZ + 25, 7, 7, 7, null, false, this);
southArea = new WorkArea(minX + 25, 32, minZ + 82, 7, 7, 7, null, true, this); southArea = new WorkArea(minX + 25, 32, minZ + 82, 7, 7, 7, null, true, this);
frame = FRAME_FILE; frame = VariantSelector.File(FRAME_FILE);
testblock = TESTBLOCK_FILE; testblock = VariantSelector.File(TESTBLOCK_FILE);
} }
@Override @Override
@@ -22,6 +22,7 @@ package de.steamwar.bausystem.region.dynamic.normal.work;
import de.steamwar.bausystem.region.GameModeConfig; import de.steamwar.bausystem.region.GameModeConfig;
import de.steamwar.bausystem.region.RegionType; import de.steamwar.bausystem.region.RegionType;
import de.steamwar.bausystem.region.dynamic.RegionConstructorData; import de.steamwar.bausystem.region.dynamic.RegionConstructorData;
import de.steamwar.bausystem.region.dynamic.VariantSelector;
import de.steamwar.bausystem.region.dynamic.normal.WorkArea; import de.steamwar.bausystem.region.dynamic.normal.WorkArea;
import de.steamwar.bausystem.region.dynamic.normal.WorkRegion; import de.steamwar.bausystem.region.dynamic.normal.WorkRegion;
import lombok.Getter; import lombok.Getter;
@@ -45,20 +46,20 @@ public class MiniWarGear21WorkRegion extends WorkRegion {
public MiniWarGear21WorkRegion(int minX, int minZ) { public MiniWarGear21WorkRegion(int minX, int minZ) {
super(minX, minZ); super(minX, minZ);
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this); area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, VariantSelector.File(REGION_FILE), false, this);
northArea = new WorkArea(minX + 29, 32, minZ + 29, 37, 26, 22, null, false, this); northArea = new WorkArea(minX + 29, 32, minZ + 29, 37, 26, 22, null, false, this);
southArea = new WorkArea(minX + 29, 32, minZ + 101, 37, 26, 22, null, true, this); southArea = new WorkArea(minX + 29, 32, minZ + 101, 37, 26, 22, null, true, this);
frame = FRAME_FILE; frame = VariantSelector.File(FRAME_FILE);
testblock = TESTBLOCK_FILE; testblock = VariantSelector.File(TESTBLOCK_FILE);
} }
public MiniWarGear21WorkRegion(RegionConstructorData regionConstructorData) { public MiniWarGear21WorkRegion(RegionConstructorData regionConstructorData) {
super(regionConstructorData); super(regionConstructorData);
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this); area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, VariantSelector.File(REGION_FILE), false, this);
northArea = new WorkArea(minX + 29, 32, minZ + 29, 37, 26, 22, null, false, this); northArea = new WorkArea(minX + 29, 32, minZ + 29, 37, 26, 22, null, false, this);
southArea = new WorkArea(minX + 29, 32, minZ + 101, 37, 26, 22, null, true, this); southArea = new WorkArea(minX + 29, 32, minZ + 101, 37, 26, 22, null, true, this);
frame = FRAME_FILE; frame = VariantSelector.File(FRAME_FILE);
testblock = TESTBLOCK_FILE; testblock = VariantSelector.File(TESTBLOCK_FILE);
} }
@Override @Override
@@ -22,6 +22,7 @@ package de.steamwar.bausystem.region.dynamic.normal.work;
import de.steamwar.bausystem.region.GameModeConfig; import de.steamwar.bausystem.region.GameModeConfig;
import de.steamwar.bausystem.region.RegionType; import de.steamwar.bausystem.region.RegionType;
import de.steamwar.bausystem.region.dynamic.RegionConstructorData; import de.steamwar.bausystem.region.dynamic.RegionConstructorData;
import de.steamwar.bausystem.region.dynamic.VariantSelector;
import de.steamwar.bausystem.region.dynamic.normal.WorkArea; import de.steamwar.bausystem.region.dynamic.normal.WorkArea;
import de.steamwar.bausystem.region.dynamic.normal.WorkRegion; import de.steamwar.bausystem.region.dynamic.normal.WorkRegion;
import lombok.Getter; import lombok.Getter;
@@ -45,20 +46,20 @@ public class WarGear21WorkRegion extends WorkRegion {
public WarGear21WorkRegion(int minX, int minZ) { public WarGear21WorkRegion(int minX, int minZ) {
super(minX, minZ); super(minX, minZ);
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this); area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, VariantSelector.File(REGION_FILE), false, this);
northArea = new WorkArea(minX + 33, 32, minZ + 42, 67, 41, 47, null, false, this); northArea = new WorkArea(minX + 33, 32, minZ + 42, 67, 41, 47, null, false, this);
southArea = new WorkArea(minX + 33, 32, minZ + 139, 67, 41, 47, null, true, this); southArea = new WorkArea(minX + 33, 32, minZ + 139, 67, 41, 47, null, true, this);
frame = FRAME_FILE; frame = VariantSelector.File(FRAME_FILE);
testblock = TESTBLOCK_FILE; testblock = VariantSelector.File(TESTBLOCK_FILE);
} }
public WarGear21WorkRegion(RegionConstructorData regionConstructorData) { public WarGear21WorkRegion(RegionConstructorData regionConstructorData) {
super(regionConstructorData); super(regionConstructorData);
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this); area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, VariantSelector.File(REGION_FILE), false, this);
northArea = new WorkArea(minX + 33, 32, minZ + 42, 67, 41, 47, null, false, this); northArea = new WorkArea(minX + 33, 32, minZ + 42, 67, 41, 47, null, false, this);
southArea = new WorkArea(minX + 33, 32, minZ + 139, 67, 41, 47, null, true, this); southArea = new WorkArea(minX + 33, 32, minZ + 139, 67, 41, 47, null, true, this);
frame = FRAME_FILE; frame = VariantSelector.File(FRAME_FILE);
testblock = TESTBLOCK_FILE; testblock = VariantSelector.File(TESTBLOCK_FILE);
} }
@Override @Override
@@ -22,6 +22,7 @@ package de.steamwar.bausystem.region.dynamic.normal.work;
import de.steamwar.bausystem.region.GameModeConfig; import de.steamwar.bausystem.region.GameModeConfig;
import de.steamwar.bausystem.region.RegionType; import de.steamwar.bausystem.region.RegionType;
import de.steamwar.bausystem.region.dynamic.RegionConstructorData; import de.steamwar.bausystem.region.dynamic.RegionConstructorData;
import de.steamwar.bausystem.region.dynamic.VariantSelector;
import de.steamwar.bausystem.region.dynamic.normal.WorkArea; import de.steamwar.bausystem.region.dynamic.normal.WorkArea;
import de.steamwar.bausystem.region.dynamic.normal.WorkRegion; import de.steamwar.bausystem.region.dynamic.normal.WorkRegion;
import lombok.Getter; import lombok.Getter;
@@ -45,20 +46,20 @@ public class WarShip21WorkRegion extends WorkRegion {
public WarShip21WorkRegion(int minX, int minZ) { public WarShip21WorkRegion(int minX, int minZ) {
super(minX, minZ); super(minX, minZ);
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this); area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, VariantSelector.File(REGION_FILE), false, this);
// northArea = new WorkArea(minX + 33, 32, minZ + 42, 67, 41, 47, null, false, this); // northArea = new WorkArea(minX + 33, 32, minZ + 42, 67, 41, 47, null, false, this);
// southArea = new WorkArea(minX + 33, 32, minZ + 139, 67, 41, 47, null, true, this); // southArea = new WorkArea(minX + 33, 32, minZ + 139, 67, 41, 47, null, true, this);
frame = FRAME_FILE; frame = VariantSelector.File(FRAME_FILE);
testblock = TESTBLOCK_FILE; testblock = VariantSelector.File(TESTBLOCK_FILE);
} }
public WarShip21WorkRegion(RegionConstructorData regionConstructorData) { public WarShip21WorkRegion(RegionConstructorData regionConstructorData) {
super(regionConstructorData); super(regionConstructorData);
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this); area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, VariantSelector.File(REGION_FILE), false, this);
// northArea = new WorkArea(minX + 33, 32, minZ + 42, 67, 41, 47, null, false, this); // northArea = new WorkArea(minX + 33, 32, minZ + 42, 67, 41, 47, null, false, this);
// southArea = new WorkArea(minX + 33, 32, minZ + 139, 67, 41, 47, null, true, this); // southArea = new WorkArea(minX + 33, 32, minZ + 139, 67, 41, 47, null, true, this);
frame = FRAME_FILE; frame = VariantSelector.File(FRAME_FILE);
testblock = TESTBLOCK_FILE; testblock = VariantSelector.File(TESTBLOCK_FILE);
} }
@Override @Override
@@ -38,7 +38,7 @@ import javax.annotation.Nullable;
import java.io.File; import java.io.File;
import java.util.function.Function; import java.util.function.Function;
public class PathAreaTile implements Region.Area { public class PathAreaTile implements Region.Area { // TODO: Change to VariantSelector
private static final File PATH_DIR = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/path"); private static final File PATH_DIR = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/path");
private static final File PATH_CENTER = new File(PATH_DIR, "PathCenter.schem"); private static final File PATH_CENTER = new File(PATH_DIR, "PathCenter.schem");
@@ -23,10 +23,7 @@ import de.steamwar.bausystem.region.FlagStorage;
import de.steamwar.bausystem.region.GameModeConfig; import de.steamwar.bausystem.region.GameModeConfig;
import de.steamwar.bausystem.region.RegionHistory; import de.steamwar.bausystem.region.RegionHistory;
import de.steamwar.bausystem.region.RegionType; import de.steamwar.bausystem.region.RegionType;
import de.steamwar.bausystem.region.dynamic.DynamicRegion; import de.steamwar.bausystem.region.dynamic.*;
import de.steamwar.bausystem.region.dynamic.NonNormalFlagStorage;
import de.steamwar.bausystem.region.dynamic.RegionConstructorData;
import de.steamwar.bausystem.region.dynamic.RegionDataRepository;
import de.steamwar.bausystem.region.dynamic.spawn.SpawnAreaTile; import de.steamwar.bausystem.region.dynamic.spawn.SpawnAreaTile;
import lombok.NonNull; import lombok.NonNull;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -46,7 +43,7 @@ public class PathRegion extends DynamicRegion {
super(minX, minZ); super(minX, minZ);
RegionDataRepository.loadFlagStorage(this, flagStorage); RegionDataRepository.loadFlagStorage(this, flagStorage);
if (minX >= -28 && minX <= 10 && minZ >= -28 && minZ <= 10) { if (minX >= -28 && minX <= 10 && minZ >= -28 && minZ <= 10) {
area = new SpawnAreaTile(minX, minZ, RESET_FILE, this); area = new SpawnAreaTile(minX, minZ, VariantSelector.File(RESET_FILE), this);
} else { } else {
area = new PathAreaTile(minX, minZ, this); area = new PathAreaTile(minX, minZ, this);
} }
@@ -56,7 +53,7 @@ public class PathRegion extends DynamicRegion {
super(regionConstructorData); super(regionConstructorData);
RegionDataRepository.loadFlagStorage(this, flagStorage); RegionDataRepository.loadFlagStorage(this, flagStorage);
if (minX >= -28 && minX <= 10 && minZ >= -28 && minZ <= 10) { if (minX >= -28 && minX <= 10 && minZ >= -28 && minZ <= 10) {
area = new SpawnAreaTile(minX, minZ, RESET_FILE, this); area = new SpawnAreaTile(minX, minZ, VariantSelector.File(RESET_FILE), this);
} else { } else {
area = new PathAreaTile(minX, minZ, this); area = new PathAreaTile(minX, minZ, this);
} }
@@ -21,6 +21,7 @@ package de.steamwar.bausystem.region.dynamic.spawn;
import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.region.Point;
import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.dynamic.VariantSelector;
import de.steamwar.bausystem.utils.PasteBuilder; import de.steamwar.bausystem.utils.PasteBuilder;
import lombok.NonNull; import lombok.NonNull;
@@ -31,16 +32,16 @@ public class SpawnAreaTile implements Region.Area {
private final int minX; private final int minX;
private final int minZ; private final int minZ;
private final File resetFile; private final VariantSelector variantSelector;
private final Point minPoint; private final Point minPoint;
private final Point maxPoint; private final Point maxPoint;
private final Point copyPoint; private final Point copyPoint;
private final Region region; private final Region region;
public SpawnAreaTile(int minX, int minZ, File resetFile, Region region) { public SpawnAreaTile(int minX, int minZ, VariantSelector variantSelector, Region region) {
this.minX = minX; this.minX = minX;
this.minZ = minZ; this.minZ = minZ;
this.resetFile = resetFile; this.variantSelector = variantSelector;
minPoint = new Point(minX, 0, minZ); minPoint = new Point(minX, 0, minZ);
maxPoint = new Point(minX + 18, 255, minZ + 18); maxPoint = new Point(minX + 18, 255, minZ + 18);
@@ -67,7 +68,7 @@ public class SpawnAreaTile implements Region.Area {
@Nullable @Nullable
@Override @Override
public File getResetFile() { public File getResetFile() {
return resetFile; return variantSelector.selectVariant(minX, minZ).orElseThrow();
} }
@Override @Override
@@ -19,11 +19,11 @@
package de.steamwar.bausystem.region.dynamic.spawn; package de.steamwar.bausystem.region.dynamic.spawn;
import de.steamwar.bausystem.region.*; import de.steamwar.bausystem.region.FlagStorage;
import de.steamwar.bausystem.region.dynamic.DynamicRegion; import de.steamwar.bausystem.region.GameModeConfig;
import de.steamwar.bausystem.region.dynamic.NonNormalFlagStorage; import de.steamwar.bausystem.region.RegionHistory;
import de.steamwar.bausystem.region.dynamic.RegionConstructorData; import de.steamwar.bausystem.region.RegionType;
import de.steamwar.bausystem.region.dynamic.RegionDataRepository; import de.steamwar.bausystem.region.dynamic.*;
import lombok.NonNull; import lombok.NonNull;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -53,15 +53,15 @@ public class SpawnPathRegion extends DynamicRegion {
area = new SpawnAreaTile(minX, minZ, getResetFile(minX, minZ), this); area = new SpawnAreaTile(minX, minZ, getResetFile(minX, minZ), this);
} }
private static File getResetFile(int minX, int minZ) { private static VariantSelector getResetFile(int minX, int minZ) {
if (minX == -28) { if (minX == -28) {
return RESET_FILE_WEST; return VariantSelector.File(RESET_FILE_WEST);
} else if (minX == 10) { } else if (minX == 10) {
return RESET_FILE_EAST; return VariantSelector.File(RESET_FILE_EAST);
} else if (minZ == -28) { } else if (minZ == -28) {
return RESET_FILE_NORTH; return VariantSelector.File(RESET_FILE_NORTH);
} else if (minZ == 10) { } else if (minZ == 10) {
return RESET_FILE_SOUTH; return VariantSelector.File(RESET_FILE_SOUTH);
} }
throw new IllegalArgumentException("Invalid minX: " + minX + ", minZ: " + minZ); throw new IllegalArgumentException("Invalid minX: " + minX + ", minZ: " + minZ);
} }
@@ -23,10 +23,7 @@ import de.steamwar.bausystem.region.FlagStorage;
import de.steamwar.bausystem.region.GameModeConfig; import de.steamwar.bausystem.region.GameModeConfig;
import de.steamwar.bausystem.region.RegionHistory; import de.steamwar.bausystem.region.RegionHistory;
import de.steamwar.bausystem.region.RegionType; import de.steamwar.bausystem.region.RegionType;
import de.steamwar.bausystem.region.dynamic.DynamicRegion; import de.steamwar.bausystem.region.dynamic.*;
import de.steamwar.bausystem.region.dynamic.NonNormalFlagStorage;
import de.steamwar.bausystem.region.dynamic.RegionConstructorData;
import de.steamwar.bausystem.region.dynamic.RegionDataRepository;
import lombok.NonNull; import lombok.NonNull;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -44,13 +41,13 @@ public class SpawnRegion extends DynamicRegion {
public SpawnRegion(int minX, int minZ) { public SpawnRegion(int minX, int minZ) {
super(minX, minZ); super(minX, minZ);
RegionDataRepository.loadFlagStorage(this, flagStorage); RegionDataRepository.loadFlagStorage(this, flagStorage);
area = new SpawnAreaTile(minX, minZ, RESET_FILE, this); area = new SpawnAreaTile(minX, minZ, VariantSelector.File(RESET_FILE), this);
} }
public SpawnRegion(RegionConstructorData regionConstructorData) { public SpawnRegion(RegionConstructorData regionConstructorData) {
super(regionConstructorData); super(regionConstructorData);
RegionDataRepository.loadFlagStorage(this, flagStorage); RegionDataRepository.loadFlagStorage(this, flagStorage);
area = new SpawnAreaTile(minX, minZ, RESET_FILE, this); area = new SpawnAreaTile(minX, minZ, VariantSelector.File(RESET_FILE), this);
} }
@Override @Override