Add VariantSelector
This commit is contained in:
@@ -22,10 +22,10 @@ package de.steamwar.bausystem.region;
|
||||
import de.steamwar.bausystem.features.region.RegionCommand;
|
||||
import de.steamwar.bausystem.region.dynamic.DynamicRegion;
|
||||
import de.steamwar.bausystem.region.dynamic.TileUtils;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.MicroWarGear21Region;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.MiniWarGear21Region;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.WarGear21Region;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.WarShip21Region;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.MicroWarGear21WorkRegion;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.MiniWarGear21WorkRegion;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.WarGear21WorkRegion;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.WarShip21WorkRegion;
|
||||
import de.steamwar.bausystem.region.dynamic.path.PathRegion;
|
||||
import de.steamwar.bausystem.shared.Pair;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
@@ -99,10 +99,10 @@ public class DynamicRegionCommand extends SWCommand {
|
||||
@RequiredArgsConstructor
|
||||
public enum Placement {
|
||||
Path(PathRegion::new, 19, 19),
|
||||
WarGear21(WarGear21Region::new, WarGear21Region.widthX, WarGear21Region.widthZ),
|
||||
MiniWarGear21(MiniWarGear21Region::new, MiniWarGear21Region.widthX, MiniWarGear21Region.widthZ),
|
||||
WarShip21(WarShip21Region::new, WarShip21Region.widthX, WarShip21Region.widthZ),
|
||||
MicroWarGear21(MicroWarGear21Region::new, MicroWarGear21Region.widthX, MicroWarGear21Region.widthZ),
|
||||
WarGear21(WarGear21WorkRegion::new, WarGear21WorkRegion.widthX, WarGear21WorkRegion.widthZ),
|
||||
MiniWarGear21(MiniWarGear21WorkRegion::new, MiniWarGear21WorkRegion.widthX, MiniWarGear21WorkRegion.widthZ),
|
||||
WarShip21(WarShip21WorkRegion::new, WarShip21WorkRegion.widthX, WarShip21WorkRegion.widthZ),
|
||||
MicroWarGear21(MicroWarGear21WorkRegion::new, MicroWarGear21WorkRegion.widthX, MicroWarGear21WorkRegion.widthZ),
|
||||
;
|
||||
|
||||
private final BiFunction<Integer, Integer, DynamicRegion> constructor;
|
||||
|
||||
@@ -21,7 +21,6 @@ package de.steamwar.bausystem.region.dynamic;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import de.steamwar.bausystem.region.FlagStorage;
|
||||
@@ -29,10 +28,10 @@ import de.steamwar.bausystem.region.Point;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.NormalFlagStorage;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.MicroWarGear21Region;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.MiniWarGear21Region;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.WarGear21Region;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.WarShip21Region;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.MicroWarGear21WorkRegion;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.MiniWarGear21WorkRegion;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.WarGear21WorkRegion;
|
||||
import de.steamwar.bausystem.region.dynamic.normal.work.WarShip21WorkRegion;
|
||||
import de.steamwar.bausystem.region.dynamic.path.PathRegion;
|
||||
import de.steamwar.bausystem.region.dynamic.spawn.SpawnPathRegion;
|
||||
import de.steamwar.bausystem.region.dynamic.spawn.SpawnRegion;
|
||||
@@ -73,10 +72,14 @@ public class RegionDataRepository {
|
||||
regionCreators.put(SpawnRegion.class.getSimpleName(), SpawnRegion::new);
|
||||
regionCreators.put(SpawnPathRegion.class.getSimpleName(), SpawnPathRegion::new);
|
||||
regionCreators.put(PathRegion.class.getSimpleName(), PathRegion::new);
|
||||
regionCreators.put(WarGear21Region.class.getSimpleName(), WarGear21Region::new);
|
||||
regionCreators.put(MiniWarGear21Region.class.getSimpleName(), MiniWarGear21Region::new);
|
||||
regionCreators.put(WarShip21Region.class.getSimpleName(), WarShip21Region::new);
|
||||
regionCreators.put(MicroWarGear21Region.class.getSimpleName(), MicroWarGear21Region::new);
|
||||
regionCreators.put(WarGear21WorkRegion.class.getSimpleName(), WarGear21WorkRegion::new);
|
||||
regionCreators.put("WarGear21Region", WarGear21WorkRegion::new); // TODO: Legacy because of rename
|
||||
regionCreators.put(MiniWarGear21WorkRegion.class.getSimpleName(), MiniWarGear21WorkRegion::new);
|
||||
regionCreators.put("MiniWarGear21Region", MiniWarGear21WorkRegion::new); // TODO: Legacy because of rename
|
||||
regionCreators.put(WarShip21WorkRegion.class.getSimpleName(), WarShip21WorkRegion::new);
|
||||
regionCreators.put("WarShip21Region", WarShip21WorkRegion::new); // TODO: Legacy because of rename
|
||||
regionCreators.put(MicroWarGear21WorkRegion.class.getSimpleName(), MicroWarGear21WorkRegion::new);
|
||||
regionCreators.put("MicroWarGear21Region", MicroWarGear21WorkRegion::new); // TODO: Legacy because of rename
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.bukkit.Bukkit;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class MicroWarGear21Region extends WorkRegion {
|
||||
public class MicroWarGear21WorkRegion extends WorkRegion {
|
||||
|
||||
public static final int widthX = 57;
|
||||
public static final int widthZ = 114;
|
||||
@@ -43,7 +43,7 @@ public class MicroWarGear21Region extends WorkRegion {
|
||||
@Getter
|
||||
private final RegionConfig gameModeConfig = new RegionConfig(null); // TODO: Implement
|
||||
|
||||
public MicroWarGear21Region(int minX, int minZ) {
|
||||
public MicroWarGear21WorkRegion(int minX, int minZ) {
|
||||
super(minX, minZ);
|
||||
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this);
|
||||
northArea = new WorkArea(minX + 25, 32, minZ + 25, 7, 7, 7, null, false, this);
|
||||
@@ -52,7 +52,7 @@ public class MicroWarGear21Region extends WorkRegion {
|
||||
testblock = TESTBLOCK_FILE;
|
||||
}
|
||||
|
||||
public MicroWarGear21Region(RegionConstructorData regionConstructorData) {
|
||||
public MicroWarGear21WorkRegion(RegionConstructorData regionConstructorData) {
|
||||
super(regionConstructorData);
|
||||
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this);
|
||||
northArea = new WorkArea(minX + 25, 32, minZ + 25, 7, 7, 7, null, false, this);
|
||||
@@ -30,7 +30,7 @@ import org.bukkit.Bukkit;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class MiniWarGear21Region extends WorkRegion {
|
||||
public class MiniWarGear21WorkRegion extends WorkRegion {
|
||||
|
||||
public static final int widthX = 95;
|
||||
public static final int widthZ = 152;
|
||||
@@ -43,7 +43,7 @@ public class MiniWarGear21Region extends WorkRegion {
|
||||
@Getter
|
||||
private final RegionConfig gameModeConfig = new RegionConfig(null); // TODO: Implement
|
||||
|
||||
public MiniWarGear21Region(int minX, int minZ) {
|
||||
public MiniWarGear21WorkRegion(int minX, int minZ) {
|
||||
super(minX, minZ);
|
||||
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this);
|
||||
northArea = new WorkArea(minX + 29, 32, minZ + 29, 37, 26, 22, null, false, this);
|
||||
@@ -52,7 +52,7 @@ public class MiniWarGear21Region extends WorkRegion {
|
||||
testblock = TESTBLOCK_FILE;
|
||||
}
|
||||
|
||||
public MiniWarGear21Region(RegionConstructorData regionConstructorData) {
|
||||
public MiniWarGear21WorkRegion(RegionConstructorData regionConstructorData) {
|
||||
super(regionConstructorData);
|
||||
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this);
|
||||
northArea = new WorkArea(minX + 29, 32, minZ + 29, 37, 26, 22, null, false, this);
|
||||
@@ -30,7 +30,7 @@ import org.bukkit.Bukkit;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class WarGear21Region extends WorkRegion {
|
||||
public class WarGear21WorkRegion extends WorkRegion {
|
||||
|
||||
public static final int widthX = 133;
|
||||
public static final int widthZ = 228;
|
||||
@@ -43,7 +43,7 @@ public class WarGear21Region extends WorkRegion {
|
||||
@Getter
|
||||
private final RegionConfig gameModeConfig = new RegionConfig(null); // TODO: Implement
|
||||
|
||||
public WarGear21Region(int minX, int minZ) {
|
||||
public WarGear21WorkRegion(int minX, int minZ) {
|
||||
super(minX, minZ);
|
||||
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this);
|
||||
northArea = new WorkArea(minX + 33, 32, minZ + 42, 67, 41, 47, null, false, this);
|
||||
@@ -52,7 +52,7 @@ public class WarGear21Region extends WorkRegion {
|
||||
testblock = TESTBLOCK_FILE;
|
||||
}
|
||||
|
||||
public WarGear21Region(RegionConstructorData regionConstructorData) {
|
||||
public WarGear21WorkRegion(RegionConstructorData regionConstructorData) {
|
||||
super(regionConstructorData);
|
||||
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this);
|
||||
northArea = new WorkArea(minX + 33, 32, minZ + 42, 67, 41, 47, null, false, this);
|
||||
@@ -30,7 +30,7 @@ import org.bukkit.Bukkit;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class WarShip21Region extends WorkRegion {
|
||||
public class WarShip21WorkRegion extends WorkRegion {
|
||||
|
||||
public static final int widthX = 285;
|
||||
public static final int widthZ = 228;
|
||||
@@ -43,7 +43,7 @@ public class WarShip21Region extends WorkRegion {
|
||||
@Getter
|
||||
private final RegionConfig gameModeConfig = new RegionConfig(null); // TODO: Implement
|
||||
|
||||
public WarShip21Region(int minX, int minZ) {
|
||||
public WarShip21WorkRegion(int minX, int minZ) {
|
||||
super(minX, minZ);
|
||||
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this);
|
||||
// northArea = new WorkArea(minX + 33, 32, minZ + 42, 67, 41, 47, null, false, this);
|
||||
@@ -52,7 +52,7 @@ public class WarShip21Region extends WorkRegion {
|
||||
testblock = TESTBLOCK_FILE;
|
||||
}
|
||||
|
||||
public WarShip21Region(RegionConstructorData regionConstructorData) {
|
||||
public WarShip21WorkRegion(RegionConstructorData regionConstructorData) {
|
||||
super(regionConstructorData);
|
||||
area = new WorkArea(minX, 0, minZ, widthX, 255, widthZ, REGION_FILE, false, this);
|
||||
// northArea = new WorkArea(minX + 33, 32, minZ + 42, 67, 41, 47, null, false, this);
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 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.dynamic.special;
|
||||
|
||||
public class DrySpecialRegion {
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 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.dynamic.special;
|
||||
|
||||
public class SpecialAreaTile {
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 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.dynamic.special;
|
||||
|
||||
public class SpecialRegion {
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 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.dynamic.special;
|
||||
|
||||
public class WetSpecialRegion {
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 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.dynamic.variants;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface VariantSelector {
|
||||
|
||||
Optional<File> selectVariant(int minX, int minZ);
|
||||
|
||||
default VariantSelector or(VariantSelector other) {
|
||||
return (minX, minZ) -> selectVariant(minX, minZ).or(() -> other.selectVariant(minX, minZ));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user