forked from SteamWar/SteamWar
Implement MiWG7PlotRegion
Implement WS230PlotRegion
This commit is contained in:
+15
-16
@@ -19,15 +19,14 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.region.dynamic.modes.microwargear_7;
|
package de.steamwar.bausystem.region.dynamic.modes.microwargear_7;
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.RegionBackups;
|
import de.steamwar.bausystem.region.*;
|
||||||
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.*;
|
||||||
|
import de.steamwar.bausystem.region.dynamic.modes.AreaBlock;
|
||||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
|
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
|
||||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
|
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
|
import de.steamwar.bausystem.shared.Pair;
|
||||||
import de.steamwar.sql.GameModeConfig;
|
import de.steamwar.sql.GameModeConfig;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -45,8 +44,7 @@ import java.util.UUID;
|
|||||||
)
|
)
|
||||||
public class MiWG7PlotRegion extends DynamicRegion {
|
public class MiWG7PlotRegion extends DynamicRegion {
|
||||||
|
|
||||||
// TODO: X +/- 1
|
protected static final int TILE_X = 3;
|
||||||
protected static final int TILE_X = 2;
|
|
||||||
protected static final int TILE_Z = 5;
|
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 File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/microwargear_7/plot");
|
||||||
@@ -55,8 +53,8 @@ public class MiWG7PlotRegion extends DynamicRegion {
|
|||||||
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
|
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
|
||||||
|
|
||||||
private final AreaTile area;
|
private final AreaTile area;
|
||||||
private final Area northArea;
|
private final AreaBlock northArea;
|
||||||
private final Area southArea;
|
private final AreaBlock southArea;
|
||||||
private final RegionHistory history;
|
private final RegionHistory history;
|
||||||
private final RegionBackups backups;
|
private final RegionBackups backups;
|
||||||
|
|
||||||
@@ -64,10 +62,11 @@ public class MiWG7PlotRegion extends DynamicRegion {
|
|||||||
super(id, minX, minZ);
|
super(id, minX, minZ);
|
||||||
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
|
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
|
||||||
// northArea = new AreaBlock();
|
|
||||||
// southArea = new AreaBlock();
|
Pair<AreaBlock, AreaBlock> pair = AreaBlock.create(this, 36, new Point(7, 7, 7), new Point(7, 0, 7), new Point(7, 7, 7), AreaBlock.CopyLocation.CENTER, 50);
|
||||||
northArea = Area.EMPTY; // TODO: Replace!
|
northArea = pair.getKey();
|
||||||
southArea = Area.EMPTY; // TODO: Replace!
|
southArea = pair.getValue();
|
||||||
|
|
||||||
regionData = new PlotRegionData(this);
|
regionData = new PlotRegionData(this);
|
||||||
history = new RegionHistory.Impl(10);
|
history = new RegionHistory.Impl(10);
|
||||||
backups = new PlotRegionBackups(this, PlotRegionData::new);
|
backups = new PlotRegionBackups(this, PlotRegionData::new);
|
||||||
@@ -88,8 +87,8 @@ public class MiWG7PlotRegion extends DynamicRegion {
|
|||||||
public @NonNull Area getBuildArea() {
|
public @NonNull Area getBuildArea() {
|
||||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||||
case NO_VALUE -> Area.EMPTY;
|
case NO_VALUE -> Area.EMPTY;
|
||||||
case NORTH -> northArea;//.withSelector(WIREFRAME);
|
case NORTH -> southArea.withSelector(WIREFRAME);
|
||||||
case SOUTH -> southArea;//.withSelector(WIREFRAME);
|
case SOUTH -> northArea.withSelector(WIREFRAME);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,8 +96,8 @@ public class MiWG7PlotRegion extends DynamicRegion {
|
|||||||
public @NonNull Area getTestblockArea() {
|
public @NonNull Area getTestblockArea() {
|
||||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||||
case NO_VALUE -> Area.EMPTY;
|
case NO_VALUE -> Area.EMPTY;
|
||||||
case NORTH -> southArea;//.withSelector(TESTBLOCK);
|
case NORTH -> northArea.withSelector(TESTBLOCK);
|
||||||
case SOUTH -> northArea;//.withSelector(TESTBLOCK);
|
case SOUTH -> southArea.withSelector(TESTBLOCK);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-15
@@ -19,15 +19,14 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.region.dynamic.modes.warship_230;
|
package de.steamwar.bausystem.region.dynamic.modes.warship_230;
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.RegionBackups;
|
import de.steamwar.bausystem.region.*;
|
||||||
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.*;
|
||||||
|
import de.steamwar.bausystem.region.dynamic.modes.AreaBlock;
|
||||||
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
import de.steamwar.bausystem.region.dynamic.modes.AreaTile;
|
||||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
|
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionBackups;
|
||||||
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
|
import de.steamwar.bausystem.region.dynamic.modes.PlotRegionData;
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
|
import de.steamwar.bausystem.shared.Pair;
|
||||||
import de.steamwar.sql.GameModeConfig;
|
import de.steamwar.sql.GameModeConfig;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -46,7 +45,7 @@ import java.util.UUID;
|
|||||||
public class WS230PlotRegion extends DynamicRegion {
|
public class WS230PlotRegion extends DynamicRegion {
|
||||||
|
|
||||||
protected static final int TILE_X = 13;
|
protected static final int TILE_X = 13;
|
||||||
protected static final int TILE_Z = 9;
|
protected static final int TILE_Z = 10;
|
||||||
|
|
||||||
private static final File DIRECTORY = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "sections/warship_230/plot");
|
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 REGION = VariantSelector.Get(new File(DIRECTORY, "region"));
|
||||||
@@ -54,8 +53,8 @@ public class WS230PlotRegion extends DynamicRegion {
|
|||||||
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
|
private static final VariantSelector WIREFRAME = VariantSelector.Get(new File(DIRECTORY, "wireframe"));
|
||||||
|
|
||||||
private final AreaTile area;
|
private final AreaTile area;
|
||||||
private final Area northArea;
|
private final AreaBlock northArea;
|
||||||
private final Area southArea;
|
private final AreaBlock southArea;
|
||||||
private final RegionHistory history;
|
private final RegionHistory history;
|
||||||
private final RegionBackups backups;
|
private final RegionBackups backups;
|
||||||
|
|
||||||
@@ -63,10 +62,11 @@ public class WS230PlotRegion extends DynamicRegion {
|
|||||||
super(id, minX, minZ);
|
super(id, minX, minZ);
|
||||||
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
Tile tile = Tile.fromXZ(minX, minZ).orElseThrow();
|
||||||
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
|
area = new AreaTile(tile, TILE_X, TILE_Z, this, REGION);
|
||||||
// northArea = new AreaBlock();
|
|
||||||
// southArea = new AreaBlock();
|
Pair<AreaBlock, AreaBlock> pair = AreaBlock.create(this, 36, new Point(230, 58, 43), new Point(12, 0, 8), new Point(12, 0, 8), AreaBlock.CopyLocation.SIDE, 136);
|
||||||
northArea = Area.EMPTY; // TODO: Replace!
|
northArea = pair.getKey();
|
||||||
southArea = Area.EMPTY; // TODO: Replace!
|
southArea = pair.getValue();
|
||||||
|
|
||||||
regionData = new PlotRegionData(this);
|
regionData = new PlotRegionData(this);
|
||||||
history = new RegionHistory.Impl(10);
|
history = new RegionHistory.Impl(10);
|
||||||
backups = new PlotRegionBackups(this, PlotRegionData::new);
|
backups = new PlotRegionBackups(this, PlotRegionData::new);
|
||||||
@@ -87,8 +87,8 @@ public class WS230PlotRegion extends DynamicRegion {
|
|||||||
public @NonNull Area getBuildArea() {
|
public @NonNull Area getBuildArea() {
|
||||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||||
case NO_VALUE -> Area.EMPTY;
|
case NO_VALUE -> Area.EMPTY;
|
||||||
case NORTH -> northArea;//.withSelector(WIREFRAME);
|
case NORTH -> southArea.withSelector(WIREFRAME);
|
||||||
case SOUTH -> southArea;//.withSelector(WIREFRAME);
|
case SOUTH -> northArea.withSelector(WIREFRAME);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,8 +96,8 @@ public class WS230PlotRegion extends DynamicRegion {
|
|||||||
public @NonNull Area getTestblockArea() {
|
public @NonNull Area getTestblockArea() {
|
||||||
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
return switch (regionData.get(Flag.TESTBLOCK).getWithDefault()) {
|
||||||
case NO_VALUE -> Area.EMPTY;
|
case NO_VALUE -> Area.EMPTY;
|
||||||
case NORTH -> southArea;//.withSelector(TESTBLOCK);
|
case NORTH -> northArea.withSelector(TESTBLOCK);
|
||||||
case SOUTH -> northArea;//.withSelector(TESTBLOCK);
|
case SOUTH -> southArea.withSelector(TESTBLOCK);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user