forked from SteamWar/SteamWar
Add initial regions
This commit is contained in:
+31
-29
@@ -161,7 +161,7 @@ public class DynamicRegionVisualizer implements SWPlayer.Component, Listener {
|
||||
RInteraction interaction = new RInteraction(entityServer, location.clone().add(0.5, 0, 0.5));
|
||||
interaction.setInteraction((player, entityAction) -> {
|
||||
if (placement != null) {
|
||||
if (regionType.isGlobal()) placement.click(tile);
|
||||
placement.click(tile, regionType.isGlobal());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -254,45 +254,47 @@ public class DynamicRegionVisualizer implements SWPlayer.Component, Listener {
|
||||
valid = true;
|
||||
}
|
||||
|
||||
public void click(Tile tile) {
|
||||
public void click(Tile tile, boolean global) {
|
||||
if (tile.getTileX() >= sourceTile.getTileX() && tile.getTileX() <= sourceTile.getTileX() + dx && tile.getTileZ() >= sourceTile.getTileZ() && tile.getTileZ() <= sourceTile.getTileZ() + dz) {
|
||||
SWInventory inv = new SWInventory(player, 9, "Place Region: " + constructorData.name());
|
||||
inv.setItem(0, new SWItem(SWItem.getDye(1), "§cDeselect", click -> {
|
||||
placement = null;
|
||||
wireframe.die();
|
||||
player.closeInventory();
|
||||
}));
|
||||
if (valid) {
|
||||
SWInventory inv = new SWInventory(player, 9, "Place Region: " + constructorData.name());
|
||||
inv.setItem(0, new SWItem(SWItem.getDye(1), "§cDeselect", click -> {
|
||||
placement = null;
|
||||
wireframe.die();
|
||||
player.closeInventory();
|
||||
}));
|
||||
inv.setItem(8, new SWItem(SWItem.getDye(10), "§aPlace", click -> {
|
||||
player.closeInventory();
|
||||
place();
|
||||
}));
|
||||
inv.open();
|
||||
} else {
|
||||
inv.setItem(8, new SWItem(SWItem.getDye(8), "§8Place", click -> {
|
||||
}));
|
||||
}
|
||||
inv.open();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (dx == 0 && dz == 0) {
|
||||
sourceTile = tile;
|
||||
} else {
|
||||
Set<Tile> tiles = new HashSet<>();
|
||||
for (int x = 0; x <= dx; x++) {
|
||||
for (int z = 0; z <= dz; z++) {
|
||||
tiles.add(Tile.fromTile(x + sourceTile.getTileX(), z + sourceTile.getTileZ()).orElseThrow());
|
||||
}
|
||||
}
|
||||
Tile selected = tiles.stream().min(Comparator.comparing(current -> {
|
||||
int dx = current.getTileX() - tile.getTileX();
|
||||
int dz = current.getTileZ() - tile.getTileZ();
|
||||
return dx * dx + dz * dz;
|
||||
}))
|
||||
.orElseThrow();
|
||||
|
||||
int dx = tile.getTileX() - selected.getTileX();
|
||||
int dz = tile.getTileZ() - selected.getTileZ();
|
||||
sourceTile = sourceTile.add(dx, dz).orElseThrow();
|
||||
if (!global) {
|
||||
return;
|
||||
}
|
||||
|
||||
Set<Tile> tiles = new HashSet<>();
|
||||
for (int x = 0; x <= dx; x++) {
|
||||
for (int z = 0; z <= dz; z++) {
|
||||
tiles.add(Tile.fromTile(x + sourceTile.getTileX(), z + sourceTile.getTileZ()).orElseThrow());
|
||||
}
|
||||
}
|
||||
Tile selected = tiles.stream().min(Comparator.comparing(current -> {
|
||||
int dx = current.getTileX() - tile.getTileX();
|
||||
int dz = current.getTileZ() - tile.getTileZ();
|
||||
return dx * dx + dz * dz;
|
||||
}))
|
||||
.orElseThrow();
|
||||
|
||||
int dx = tile.getTileX() - selected.getTileX();
|
||||
int dz = tile.getTileZ() - selected.getTileZ();
|
||||
sourceTile = sourceTile.add(dx, dz).orElseThrow();
|
||||
check();
|
||||
}
|
||||
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes;
|
||||
|
||||
import de.steamwar.bausystem.region.Point;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.dynamic.VariantSelector;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
import lombok.NonNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
public class AreaBlock implements Region.Area {
|
||||
|
||||
private final UUID regionIdentifier;
|
||||
private final Point minPoint;
|
||||
private final Point maxPoint;
|
||||
private final Point copyPoint;
|
||||
private VariantSelector selector = null;
|
||||
|
||||
public AreaBlock(@NonNull Region region, @NonNull Point minPoint, @NonNull Point maxPoint, @NonNull Point copyPoint) {
|
||||
this.regionIdentifier = region.getID();
|
||||
this.minPoint = minPoint;
|
||||
this.maxPoint = maxPoint;
|
||||
this.copyPoint = copyPoint;
|
||||
}
|
||||
|
||||
public AreaBlock withSelector(VariantSelector selector) {
|
||||
this.selector = selector;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Point getMinPoint(boolean extension) {
|
||||
return minPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Point getMaxPoint(boolean extension) {
|
||||
return maxPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Point getCopyPoint() {
|
||||
return copyPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable File getResetFile() {
|
||||
if (selector == null) return null;
|
||||
return selector.select(regionIdentifier, 0).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void place(PasteBuilder pasteBuilder, boolean extension) {
|
||||
// TODO: Implement placing!
|
||||
}
|
||||
}
|
||||
+12
-14
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.region.dynamic.modes.microwargear_7.display;
|
||||
package de.steamwar.bausystem.region.dynamic.modes;
|
||||
|
||||
import de.steamwar.bausystem.region.Point;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
@@ -26,27 +26,27 @@ import de.steamwar.bausystem.region.dynamic.Tile;
|
||||
import de.steamwar.bausystem.region.dynamic.VariantSelector;
|
||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
public class MiWG7DisplayArea implements Region.Area {
|
||||
|
||||
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/microwargear_7/display");
|
||||
private static final VariantSelector SELECTOR = VariantSelector.Get(DIRECTORY);
|
||||
public class AreaTile implements Region.Area {
|
||||
|
||||
private final UUID regionIdentifier;
|
||||
private final Point minPoint;
|
||||
private final Point maxPoint;
|
||||
private final Point copyPoint;
|
||||
private final VariantSelector selector;
|
||||
|
||||
public MiWG7DisplayArea(Tile tile, MiWG7DisplayRegion region) {
|
||||
this.regionIdentifier = region.getID();
|
||||
public AreaTile(Tile tile, int tileX, int tileZ, Region region, VariantSelector selector) {
|
||||
regionIdentifier = region.getID();
|
||||
minPoint = Point.fromLocation(tile.getMinLocation()).setY(WORLD_MIN_Y);
|
||||
maxPoint = Point.fromLocation(tile.getMaxLocation()).setY(WORLD_MAX_Y);
|
||||
copyPoint = Point.fromLocation(tile.getCenterLocation());
|
||||
maxPoint = Point.fromLocation(tile.add(tileX - 1, tileZ - 1).orElseThrow().getMaxLocation()).setY(WORLD_MAX_Y);
|
||||
int x = minPoint.getX() + (maxPoint.getX() - minPoint.getX()) / 2;
|
||||
int z = minPoint.getZ() + (maxPoint.getZ() - minPoint.getZ()) / 2;
|
||||
copyPoint = new Point(x, 0, z);
|
||||
this.selector = selector;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,9 +71,7 @@ public class MiWG7DisplayArea implements Region.Area {
|
||||
|
||||
@Override
|
||||
public void place(PasteBuilder pasteBuilder, boolean extension) {
|
||||
File resetFile = SELECTOR.select(regionIdentifier, 0).orElse(null);
|
||||
if (resetFile != null) {
|
||||
PasteUtils.paste(resetFile, minPoint, 0);
|
||||
}
|
||||
File resetFile = selector.select(regionIdentifier, 0).orElse(null);
|
||||
if (resetFile != null) PasteUtils.paste(resetFile, minPoint, 0);
|
||||
}
|
||||
}
|
||||
+12
-10
@@ -17,34 +17,36 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.region.dynamic.modes.microwargear_7.display;
|
||||
package de.steamwar.bausystem.region.dynamic.modes.microwargear_7;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionHistory;
|
||||
import de.steamwar.bausystem.region.RegionType;
|
||||
import de.steamwar.bausystem.region.dynamic.DynamicRegion;
|
||||
import de.steamwar.bausystem.region.dynamic.DynamicRegionRepository;
|
||||
import de.steamwar.bausystem.region.dynamic.RegionConstructorData;
|
||||
import de.steamwar.bausystem.region.dynamic.Tile;
|
||||
import de.steamwar.bausystem.region.dynamic.*;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.DisplayRegionData;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.microwargear_7.MiWG7Utils;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
@RegionConstructorData(
|
||||
identifier = "microwargear_display",
|
||||
name = "MicoWarGearDisplay",
|
||||
identifier = "microwargear_display_7",
|
||||
name = "MicroWarGearDisplay",
|
||||
material = Material.STONE_BUTTON,
|
||||
widthX = Tile.tileSize,
|
||||
widthZ = Tile.tileSize
|
||||
)
|
||||
public class MiWG7DisplayRegion extends DynamicRegion {
|
||||
|
||||
private MiWG7DisplayArea area;
|
||||
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/microwargear_7/display");
|
||||
private static final VariantSelector SELECTOR = VariantSelector.Get(DIRECTORY);
|
||||
|
||||
private Area area;
|
||||
private Tile tile;
|
||||
|
||||
public MiWG7DisplayRegion(UUID id, int minX, int minZ) {
|
||||
@@ -54,7 +56,7 @@ public class MiWG7DisplayRegion extends DynamicRegion {
|
||||
@Override
|
||||
public void init() {
|
||||
tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||
area = new MiWG7DisplayArea(tile, this);
|
||||
area = new AreaTile(tile, 1, 1, this, SELECTOR);
|
||||
regionData = new DisplayRegionData(this);
|
||||
}
|
||||
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.microwargear_7;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionHistory;
|
||||
import de.steamwar.bausystem.region.RegionType;
|
||||
import de.steamwar.bausystem.region.dynamic.*;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
@RegionConstructorData(
|
||||
identifier = "microwargear_plot_7",
|
||||
name = "MicroWarGearPlot",
|
||||
material = Material.STONE_BUTTON,
|
||||
widthX = Tile.tileSize * MiWG7PlotRegion.TILE_X,
|
||||
widthZ = Tile.tileSize * MiWG7PlotRegion.TILE_Z
|
||||
)
|
||||
public class MiWG7PlotRegion extends DynamicRegion {
|
||||
|
||||
protected static final int TILE_X = 2;
|
||||
protected static final int TILE_Z = 5;
|
||||
|
||||
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/microwargear_7/plot");
|
||||
private static final VariantSelector REGION = VariantSelector.Get(new File(DIRECTORY, "region"));
|
||||
private static final VariantSelector TESTBLOCK = VariantSelector.Get(new File(DIRECTORY, "testblock"));
|
||||
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
|
||||
|
||||
private AreaTile area;
|
||||
private Area northArea;
|
||||
private Area southArea;
|
||||
private final RegionHistory history;
|
||||
private final RegionBackups backups;
|
||||
|
||||
public MiWG7PlotRegion(UUID id, int minX, int minZ) {
|
||||
super(id, minX, minZ);
|
||||
history = new RegionHistory.Impl(10);
|
||||
backups = new PlotRegionBackups(this, PlotRegionData::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
|
||||
// northArea = new AreaBlock();
|
||||
// southArea = new AreaBlock();
|
||||
northArea = Area.EMPTY; // TODO: Replace!
|
||||
southArea = Area.EMPTY; // TODO: Replace!
|
||||
regionData = new PlotRegionData(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionType getType() {
|
||||
return RegionType.DRY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getBuildArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> northArea;//.withSelector(WIREFRAME);
|
||||
case SOUTH -> southArea;//.withSelector(WIREFRAME);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getTestblockArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> southArea;//.withSelector(TESTBLOCK);
|
||||
case SOUTH -> northArea;//.withSelector(TESTBLOCK);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull GameModeConfig<Material, String> getGameModeConfig() {
|
||||
return MiWG7Utils.GAME_MODE_CONFIG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionHistory getHistory() {
|
||||
return history;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionBackups getBackups() {
|
||||
return backups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
DynamicRegionRepository.saveRegion(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(RegionData regionData) {
|
||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.miniwargear;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionHistory;
|
||||
import de.steamwar.bausystem.region.RegionType;
|
||||
import de.steamwar.bausystem.region.dynamic.*;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.DisplayRegionData;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
@RegionConstructorData(
|
||||
identifier = "miniwargear_display",
|
||||
name = "MiniWarGearDisplay",
|
||||
material = Material.END_STONE_BRICK_SLAB,
|
||||
widthX = MWGDisplayRegion.TILE_X * Tile.tileSize,
|
||||
widthZ = MWGDisplayRegion.TILE_Z * Tile.tileSize
|
||||
)
|
||||
public class MWGDisplayRegion extends DynamicRegion {
|
||||
|
||||
protected static final int TILE_X = 3;
|
||||
protected static final int TILE_Z = 2;
|
||||
|
||||
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/miniwargear/display");
|
||||
private static final VariantSelector SELECTOR = VariantSelector.Get(DIRECTORY);
|
||||
|
||||
private Area area;
|
||||
private Tile tile;
|
||||
|
||||
public MWGDisplayRegion(UUID id, int minX, int minZ) {
|
||||
super(id, minX, minZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, SELECTOR);
|
||||
regionData = new DisplayRegionData(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionType getType() {
|
||||
return RegionType.DRY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getBuildArea() {
|
||||
return Area.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getTestblockArea() {
|
||||
return Area.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull GameModeConfig<Material, String> getGameModeConfig() {
|
||||
return MWGUtils.GAME_MODE_CONFIG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionHistory getHistory() {
|
||||
return RegionHistory.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionBackups getBackups() {
|
||||
return RegionBackups.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
DynamicRegionRepository.saveRegion(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(RegionData regionData) {
|
||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
||||
}
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.miniwargear;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionHistory;
|
||||
import de.steamwar.bausystem.region.RegionType;
|
||||
import de.steamwar.bausystem.region.dynamic.*;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
@RegionConstructorData(
|
||||
identifier = "miniwargear_plot",
|
||||
name = "MiniWarGearPlot",
|
||||
material = Material.END_STONE_BRICK_SLAB,
|
||||
widthX = Tile.tileSize * MWGPlotRegion.TILE_X,
|
||||
widthZ = Tile.tileSize * MWGPlotRegion.TILE_Z
|
||||
)
|
||||
public class MWGPlotRegion extends DynamicRegion {
|
||||
|
||||
protected static final int TILE_X = 4;
|
||||
protected static final int TILE_Z = 6;
|
||||
|
||||
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/miniwargear/plot");
|
||||
private static final VariantSelector REGION = VariantSelector.Get(new File(DIRECTORY, "region"));
|
||||
private static final VariantSelector TESTBLOCK = VariantSelector.Get(new File(DIRECTORY, "testblock"));
|
||||
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
|
||||
|
||||
private AreaTile area;
|
||||
private Area northArea;
|
||||
private Area southArea;
|
||||
private final RegionHistory history;
|
||||
private final RegionBackups backups;
|
||||
|
||||
public MWGPlotRegion(UUID id, int minX, int minZ) {
|
||||
super(id, minX, minZ);
|
||||
history = new RegionHistory.Impl(10);
|
||||
backups = new PlotRegionBackups(this, PlotRegionData::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
|
||||
// northArea = new AreaBlock();
|
||||
// southArea = new AreaBlock();
|
||||
northArea = Area.EMPTY; // TODO: Replace!
|
||||
southArea = Area.EMPTY; // TODO: Replace!
|
||||
regionData = new PlotRegionData(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionType getType() {
|
||||
return RegionType.DRY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getBuildArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> northArea;//.withSelector(WIREFRAME);
|
||||
case SOUTH -> southArea;//.withSelector(WIREFRAME);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getTestblockArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> southArea;//.withSelector(TESTBLOCK);
|
||||
case SOUTH -> northArea;//.withSelector(TESTBLOCK);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull GameModeConfig<Material, String> getGameModeConfig() {
|
||||
return MWGUtils.GAME_MODE_CONFIG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionHistory getHistory() {
|
||||
return history;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionBackups getBackups() {
|
||||
return backups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
DynamicRegionRepository.saveRegion(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(RegionData regionData) {
|
||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.miniwargear;
|
||||
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Material;
|
||||
|
||||
@UtilityClass
|
||||
public class MWGUtils {
|
||||
|
||||
public static final GameModeConfig<Material, String> GAME_MODE_CONFIG;
|
||||
|
||||
static {
|
||||
GameModeConfig<Material, String> config = GameModeConfig.getByGameName("MiniWarGear");
|
||||
GAME_MODE_CONFIG = config != null ? config : GameModeConfig.getDefaults();
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.wargear_45;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionHistory;
|
||||
import de.steamwar.bausystem.region.RegionType;
|
||||
import de.steamwar.bausystem.region.dynamic.*;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.DisplayRegionData;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
@RegionConstructorData(
|
||||
identifier = "wargear_display_45",
|
||||
name = "WarGearDisplay 45",
|
||||
material = Material.END_STONE_BRICKS,
|
||||
widthX = WG45DisplayRegion.TILE_X * Tile.tileSize,
|
||||
widthZ = WG45DisplayRegion.TILE_Z * Tile.tileSize
|
||||
)
|
||||
public class WG45DisplayRegion extends DynamicRegion {
|
||||
|
||||
protected static final int TILE_X = 5;
|
||||
protected static final int TILE_Z = 4;
|
||||
|
||||
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/wargear_45/display");
|
||||
private static final VariantSelector SELECTOR = VariantSelector.Get(DIRECTORY);
|
||||
|
||||
private Area area;
|
||||
private Tile tile;
|
||||
|
||||
public WG45DisplayRegion(UUID id, int minX, int minZ) {
|
||||
super(id, minX, minZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, SELECTOR);
|
||||
regionData = new DisplayRegionData(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionType getType() {
|
||||
return RegionType.DRY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getBuildArea() {
|
||||
return Area.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getTestblockArea() {
|
||||
return Area.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull GameModeConfig<Material, String> getGameModeConfig() {
|
||||
return WG45Utils.GAME_MODE_CONFIG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionHistory getHistory() {
|
||||
return RegionHistory.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionBackups getBackups() {
|
||||
return RegionBackups.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
DynamicRegionRepository.saveRegion(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(RegionData regionData) {
|
||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
||||
}
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.wargear_45;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionHistory;
|
||||
import de.steamwar.bausystem.region.RegionType;
|
||||
import de.steamwar.bausystem.region.dynamic.*;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.miniwargear.MWGUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
@RegionConstructorData(
|
||||
identifier = "wargear_plot_45",
|
||||
name = "WarGearPlot 45",
|
||||
material = Material.END_STONE_BRICKS,
|
||||
widthX = Tile.tileSize * WG45PlotRegion.TILE_X,
|
||||
widthZ = Tile.tileSize * WG45PlotRegion.TILE_Z
|
||||
)
|
||||
public class WG45PlotRegion extends DynamicRegion {
|
||||
|
||||
protected static final int TILE_X = 7;
|
||||
protected static final int TILE_Z = 10;
|
||||
|
||||
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/wargear_45/plot");
|
||||
private static final VariantSelector REGION = VariantSelector.Get(new File(DIRECTORY, "region"));
|
||||
private static final VariantSelector TESTBLOCK = VariantSelector.Get(new File(DIRECTORY, "testblock"));
|
||||
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
|
||||
|
||||
private AreaTile area;
|
||||
private Area northArea;
|
||||
private Area southArea;
|
||||
private final RegionHistory history;
|
||||
private final RegionBackups backups;
|
||||
|
||||
public WG45PlotRegion(UUID id, int minX, int minZ) {
|
||||
super(id, minX, minZ);
|
||||
history = new RegionHistory.Impl(10);
|
||||
backups = new PlotRegionBackups(this, PlotRegionData::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
|
||||
// northArea = new AreaBlock();
|
||||
// southArea = new AreaBlock();
|
||||
northArea = Area.EMPTY; // TODO: Replace!
|
||||
southArea = Area.EMPTY; // TODO: Replace!
|
||||
regionData = new PlotRegionData(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionType getType() {
|
||||
return RegionType.DRY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getBuildArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> northArea;//.withSelector(WIREFRAME);
|
||||
case SOUTH -> southArea;//.withSelector(WIREFRAME);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getTestblockArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> southArea;//.withSelector(TESTBLOCK);
|
||||
case SOUTH -> northArea;//.withSelector(TESTBLOCK);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull GameModeConfig<Material, String> getGameModeConfig() {
|
||||
return MWGUtils.GAME_MODE_CONFIG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionHistory getHistory() {
|
||||
return history;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionBackups getBackups() {
|
||||
return backups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
DynamicRegionRepository.saveRegion(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(RegionData regionData) {
|
||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.wargear_45;
|
||||
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Material;
|
||||
|
||||
@UtilityClass
|
||||
public class WG45Utils {
|
||||
|
||||
public static final GameModeConfig<Material, String> GAME_MODE_CONFIG;
|
||||
|
||||
static {
|
||||
GameModeConfig<Material, String> config = GameModeConfig.getByGameName("WarGear");
|
||||
GAME_MODE_CONFIG = config != null ? config : GameModeConfig.getDefaults();
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.warship_175;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionHistory;
|
||||
import de.steamwar.bausystem.region.RegionType;
|
||||
import de.steamwar.bausystem.region.dynamic.*;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.DisplayRegionData;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
@RegionConstructorData(
|
||||
identifier = "warship_display_175",
|
||||
name = "WarShipDisplay 175",
|
||||
material = Material.BIRCH_BOAT,
|
||||
widthX = WS175DisplayRegion.TILE_X * Tile.tileSize,
|
||||
widthZ = WS175DisplayRegion.TILE_Z * Tile.tileSize
|
||||
)
|
||||
public class WS175DisplayRegion extends DynamicRegion {
|
||||
|
||||
protected static final int TILE_X = 10;
|
||||
protected static final int TILE_Z = 3;
|
||||
|
||||
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/warship_175/display");
|
||||
private static final VariantSelector SELECTOR = VariantSelector.Get(DIRECTORY);
|
||||
|
||||
private Area area;
|
||||
private Tile tile;
|
||||
|
||||
public WS175DisplayRegion(UUID id, int minX, int minZ) {
|
||||
super(id, minX, minZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, SELECTOR);
|
||||
regionData = new DisplayRegionData(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionType getType() {
|
||||
return RegionType.WET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getBuildArea() {
|
||||
return Area.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getTestblockArea() {
|
||||
return Area.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull GameModeConfig<Material, String> getGameModeConfig() {
|
||||
return WS175Utils.GAME_MODE_CONFIG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionHistory getHistory() {
|
||||
return RegionHistory.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionBackups getBackups() {
|
||||
return RegionBackups.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
DynamicRegionRepository.saveRegion(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(RegionData regionData) {
|
||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
||||
}
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.warship_175;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionHistory;
|
||||
import de.steamwar.bausystem.region.RegionType;
|
||||
import de.steamwar.bausystem.region.dynamic.*;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.miniwargear.MWGUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
@RegionConstructorData(
|
||||
identifier = "warship_plot_175",
|
||||
name = "WarShipPlot 175",
|
||||
material = Material.BIRCH_BOAT,
|
||||
widthX = Tile.tileSize * WS175PlotRegion.TILE_X,
|
||||
widthZ = Tile.tileSize * WS175PlotRegion.TILE_Z
|
||||
)
|
||||
public class WS175PlotRegion extends DynamicRegion {
|
||||
|
||||
protected static final int TILE_X = 10;
|
||||
protected static final int TILE_Z = 9;
|
||||
|
||||
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/warship_175/plot");
|
||||
private static final VariantSelector REGION = VariantSelector.Get(new File(DIRECTORY, "region"));
|
||||
private static final VariantSelector TESTBLOCK = VariantSelector.Get(new File(DIRECTORY, "testblock"));
|
||||
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
|
||||
|
||||
private AreaTile area;
|
||||
private Area northArea;
|
||||
private Area southArea;
|
||||
private final RegionHistory history;
|
||||
private final RegionBackups backups;
|
||||
|
||||
public WS175PlotRegion(UUID id, int minX, int minZ) {
|
||||
super(id, minX, minZ);
|
||||
history = new RegionHistory.Impl(10);
|
||||
backups = new PlotRegionBackups(this, PlotRegionData::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
|
||||
// northArea = new AreaBlock();
|
||||
// southArea = new AreaBlock();
|
||||
northArea = Area.EMPTY; // TODO: Replace!
|
||||
southArea = Area.EMPTY; // TODO: Replace!
|
||||
regionData = new PlotRegionData(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionType getType() {
|
||||
return RegionType.DRY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getBuildArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> northArea;//.withSelector(WIREFRAME);
|
||||
case SOUTH -> southArea;//.withSelector(WIREFRAME);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getTestblockArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> southArea;//.withSelector(TESTBLOCK);
|
||||
case SOUTH -> northArea;//.withSelector(TESTBLOCK);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull GameModeConfig<Material, String> getGameModeConfig() {
|
||||
return MWGUtils.GAME_MODE_CONFIG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionHistory getHistory() {
|
||||
return history;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionBackups getBackups() {
|
||||
return backups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
DynamicRegionRepository.saveRegion(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(RegionData regionData) {
|
||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.warship_175;
|
||||
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Material;
|
||||
|
||||
@UtilityClass
|
||||
public class WS175Utils {
|
||||
|
||||
public static final GameModeConfig<Material, String> GAME_MODE_CONFIG;
|
||||
|
||||
static {
|
||||
GameModeConfig<Material, String> config = GameModeConfig.getByGameName("WarShip");
|
||||
GAME_MODE_CONFIG = config != null ? config : GameModeConfig.getDefaults();
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.warship_230;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionHistory;
|
||||
import de.steamwar.bausystem.region.RegionType;
|
||||
import de.steamwar.bausystem.region.dynamic.*;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.DisplayRegionData;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
@RegionConstructorData(
|
||||
identifier = "warship_display_230",
|
||||
name = "WarShipDisplay 230",
|
||||
material = Material.BIRCH_BOAT,
|
||||
widthX = WS230DisplayRegion.TILE_X * Tile.tileSize,
|
||||
widthZ = WS230DisplayRegion.TILE_Z * Tile.tileSize
|
||||
)
|
||||
public class WS230DisplayRegion extends DynamicRegion {
|
||||
|
||||
protected static final int TILE_X = 13;
|
||||
protected static final int TILE_Z = 3;
|
||||
|
||||
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/warship_230/display");
|
||||
private static final VariantSelector SELECTOR = VariantSelector.Get(DIRECTORY);
|
||||
|
||||
private Area area;
|
||||
private Tile tile;
|
||||
|
||||
public WS230DisplayRegion(UUID id, int minX, int minZ) {
|
||||
super(id, minX, minZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, SELECTOR);
|
||||
regionData = new DisplayRegionData(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionType getType() {
|
||||
return RegionType.WET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getBuildArea() {
|
||||
return Area.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getTestblockArea() {
|
||||
return Area.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull GameModeConfig<Material, String> getGameModeConfig() {
|
||||
return WS230Utils.GAME_MODE_CONFIG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionHistory getHistory() {
|
||||
return RegionHistory.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionBackups getBackups() {
|
||||
return RegionBackups.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
DynamicRegionRepository.saveRegion(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(RegionData regionData) {
|
||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
||||
}
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.warship_230;
|
||||
|
||||
import de.steamwar.bausystem.region.RegionBackups;
|
||||
import de.steamwar.bausystem.region.RegionData;
|
||||
import de.steamwar.bausystem.region.RegionHistory;
|
||||
import de.steamwar.bausystem.region.RegionType;
|
||||
import de.steamwar.bausystem.region.dynamic.*;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
|
||||
import de.steamwar.bausystem.region.dynamic.modes.miniwargear.MWGUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.NonNull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
@RegionConstructorData(
|
||||
identifier = "warship_plot_230",
|
||||
name = "WarShipPlot 230",
|
||||
material = Material.BIRCH_BOAT,
|
||||
widthX = Tile.tileSize * WS230PlotRegion.TILE_X,
|
||||
widthZ = Tile.tileSize * WS230PlotRegion.TILE_Z
|
||||
)
|
||||
public class WS230PlotRegion extends DynamicRegion {
|
||||
|
||||
protected static final int TILE_X = 13;
|
||||
protected static final int TILE_Z = 9;
|
||||
|
||||
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/warship_230/plot");
|
||||
private static final VariantSelector REGION = VariantSelector.Get(new File(DIRECTORY, "region"));
|
||||
private static final VariantSelector TESTBLOCK = VariantSelector.Get(new File(DIRECTORY, "testblock"));
|
||||
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
|
||||
|
||||
private AreaTile area;
|
||||
private Area northArea;
|
||||
private Area southArea;
|
||||
private final RegionHistory history;
|
||||
private final RegionBackups backups;
|
||||
|
||||
public WS230PlotRegion(UUID id, int minX, int minZ) {
|
||||
super(id, minX, minZ);
|
||||
history = new RegionHistory.Impl(10);
|
||||
backups = new PlotRegionBackups(this, PlotRegionData::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
|
||||
// northArea = new AreaBlock();
|
||||
// southArea = new AreaBlock();
|
||||
northArea = Area.EMPTY; // TODO: Replace!
|
||||
southArea = Area.EMPTY; // TODO: Replace!
|
||||
regionData = new PlotRegionData(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionType getType() {
|
||||
return RegionType.DRY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getBuildArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> northArea;//.withSelector(WIREFRAME);
|
||||
case SOUTH -> southArea;//.withSelector(WIREFRAME);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Area getTestblockArea() {
|
||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||
case NO_VALUE -> Area.EMPTY;
|
||||
case NORTH -> southArea;//.withSelector(TESTBLOCK);
|
||||
case SOUTH -> northArea;//.withSelector(TESTBLOCK);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull GameModeConfig<Material, String> getGameModeConfig() {
|
||||
return MWGUtils.GAME_MODE_CONFIG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionHistory getHistory() {
|
||||
return history;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionBackups getBackups() {
|
||||
return backups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
DynamicRegionRepository.saveRegion(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(RegionData regionData) {
|
||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 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.modes.warship_230;
|
||||
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Material;
|
||||
|
||||
@UtilityClass
|
||||
public class WS230Utils {
|
||||
|
||||
public static final GameModeConfig<Material, String> GAME_MODE_CONFIG;
|
||||
|
||||
static {
|
||||
GameModeConfig<Material, String> config = GameModeConfig.getByGameName("WarShip");
|
||||
GAME_MODE_CONFIG = config != null ? config : GameModeConfig.getDefaults();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user