forked from SteamWar/SteamWar
Cleanup stuff
This commit is contained in:
@@ -105,6 +105,11 @@ public interface Region extends RegionDataStore {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean inRegion(int x, int z, boolean extension) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Clipboard copy(boolean extension) {
|
public Clipboard copy(boolean extension) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public interface RegionSystem {
|
|||||||
* Only contains Regions of the same Type as the one you inputted.
|
* Only contains Regions of the same Type as the one you inputted.
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
Stream<Region> getConnectedRegions(Region region);
|
Stream<Region> getConnectedRegions(@NonNull Region region);
|
||||||
|
|
||||||
private static RegionSystem init() {
|
private static RegionSystem init() {
|
||||||
if (Core.getVersion() >= 21) {
|
if (Core.getVersion() >= 21) {
|
||||||
@@ -130,7 +130,7 @@ public interface RegionSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull Stream<Region> getConnectedRegions(Region region) {
|
public @NonNull Stream<Region> getConnectedRegions(@NonNull Region region) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-7
@@ -40,7 +40,6 @@ import java.util.stream.Stream;
|
|||||||
|
|
||||||
public class DynamicRegionSystem implements RegionSystem {
|
public class DynamicRegionSystem implements RegionSystem {
|
||||||
|
|
||||||
private static final int TILE_SIZE_ADJUSTED = Tile.tileSize - 1;
|
|
||||||
public static DynamicRegionSystem INSTANCE;
|
public static DynamicRegionSystem INSTANCE;
|
||||||
|
|
||||||
private static final Map<Long, Region> regionCache = new LinkedHashMap<>(16, 0.75f, true) {
|
private static final Map<Long, Region> regionCache = new LinkedHashMap<>(16, 0.75f, true) {
|
||||||
@@ -140,11 +139,6 @@ public class DynamicRegionSystem implements RegionSystem {
|
|||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Region get(int x, int z, boolean fastCache, Collection<Region> regions) {
|
|
||||||
Tile tile = Tile.fromXZ(x, z).orElse(null);
|
|
||||||
return get(tile, fastCache, regions);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull Region get(@NonNull Location location) {
|
public @NonNull Region get(@NonNull Location location) {
|
||||||
return get(Tile.fromLocation(location).orElse(null), true, regionMap.values());
|
return get(Tile.fromLocation(location).orElse(null), true, regionMap.values());
|
||||||
@@ -244,7 +238,7 @@ public class DynamicRegionSystem implements RegionSystem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public Stream<Region> getConnectedRegions(Region region) {
|
public Stream<Region> getConnectedRegions(@NonNull Region region) {
|
||||||
Set<Region> regions = regionTypeMap.get(region.getType());
|
Set<Region> regions = regionTypeMap.get(region.getType());
|
||||||
|
|
||||||
Set<Region> connected = new HashSet<>();
|
Set<Region> connected = new HashSet<>();
|
||||||
|
|||||||
+13
-2
@@ -26,6 +26,7 @@ import de.steamwar.bausystem.region.Point;
|
|||||||
import de.steamwar.bausystem.region.Region;
|
import de.steamwar.bausystem.region.Region;
|
||||||
import de.steamwar.bausystem.region.RegionData;
|
import de.steamwar.bausystem.region.RegionData;
|
||||||
import de.steamwar.bausystem.region.dynamic.path.PathRegion;
|
import de.steamwar.bausystem.region.dynamic.path.PathRegion;
|
||||||
|
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ public abstract class DynamicRegion implements Region {
|
|||||||
// Updating world state for all neighbouring PathRegions
|
// Updating world state for all neighbouring PathRegions
|
||||||
list.forEach(data -> {
|
list.forEach(data -> {
|
||||||
if (needsFullReset.contains(data.region.getID())) {
|
if (needsFullReset.contains(data.region.getID())) {
|
||||||
data.region.getArea().reset(null, false); // TODO: Implement!
|
data.region.getArea().reset(new PasteBuilder(), false);
|
||||||
} else {
|
} else {
|
||||||
data.region.update(this, data.direction.opposite());
|
data.region.update(this, data.direction.opposite());
|
||||||
}
|
}
|
||||||
@@ -130,7 +131,17 @@ public abstract class DynamicRegion implements Region {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull UUID getID() {
|
public final @NonNull UUID getID() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void save() {
|
||||||
|
DynamicRegionRepository.saveRegion(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void load(RegionData regionData) {
|
||||||
|
DynamicRegionRepository.loadRegionData(this, regionData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-10
@@ -109,14 +109,4 @@ public class MiWG7DisplayRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return RegionBackups.EMPTY;
|
return RegionBackups.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-10
@@ -131,14 +131,4 @@ public class MiWG7PlotRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return backups;
|
return backups;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-10
@@ -109,14 +109,4 @@ public class MWGDisplayRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return RegionBackups.EMPTY;
|
return RegionBackups.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-10
@@ -131,14 +131,4 @@ public class MWGPlotRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return backups;
|
return backups;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-10
@@ -109,14 +109,4 @@ public class WG45DisplayRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return RegionBackups.EMPTY;
|
return RegionBackups.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-10
@@ -131,14 +131,4 @@ public class WG45PlotRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return backups;
|
return backups;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-10
@@ -109,14 +109,4 @@ public class WS175DisplayRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return RegionBackups.EMPTY;
|
return RegionBackups.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-10
@@ -131,14 +131,4 @@ public class WS175PlotRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return backups;
|
return backups;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-10
@@ -109,14 +109,4 @@ public class WS230DisplayRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return RegionBackups.EMPTY;
|
return RegionBackups.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-10
@@ -131,14 +131,4 @@ public class WS230PlotRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return backups;
|
return backups;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-12
@@ -32,7 +32,6 @@ import de.steamwar.bausystem.shared.Pair;
|
|||||||
import de.steamwar.bausystem.utils.PasteBuilder;
|
import de.steamwar.bausystem.utils.PasteBuilder;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -144,17 +143,6 @@ public class PathArea implements Region.Area {
|
|||||||
return Point.ZERO;
|
return Point.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean inRegion(Location location, boolean extension) {
|
|
||||||
return inRegion(location.getBlockX(), location.getBlockZ(), extension);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean inRegion(int x, int z, boolean extension) {
|
|
||||||
// TODO: Implement further!
|
|
||||||
return Region.Area.super.inRegion(x, z, extension);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable Clipboard copy(boolean extension) {
|
public @Nullable Clipboard copy(boolean extension) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
-15
@@ -128,19 +128,4 @@ public class PathRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return RegionBackups.EMPTY;
|
return RegionBackups.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return tile + "=" + getID();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-11
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.region.dynamic.special.dry;
|
|||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.stream.JsonWriter;
|
import com.google.gson.stream.JsonWriter;
|
||||||
import de.steamwar.bausystem.region.RegionBackups;
|
import de.steamwar.bausystem.region.RegionBackups;
|
||||||
import de.steamwar.bausystem.region.RegionData;
|
|
||||||
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.*;
|
import de.steamwar.bausystem.region.dynamic.*;
|
||||||
@@ -109,14 +108,4 @@ public class DryRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return RegionBackups.EMPTY;
|
return RegionBackups.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-11
@@ -22,7 +22,6 @@ package de.steamwar.bausystem.region.dynamic.special.wet;
|
|||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.stream.JsonWriter;
|
import com.google.gson.stream.JsonWriter;
|
||||||
import de.steamwar.bausystem.region.RegionBackups;
|
import de.steamwar.bausystem.region.RegionBackups;
|
||||||
import de.steamwar.bausystem.region.RegionData;
|
|
||||||
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.*;
|
import de.steamwar.bausystem.region.dynamic.*;
|
||||||
@@ -108,14 +107,4 @@ public class WetRegion extends DynamicRegion {
|
|||||||
public @NonNull RegionBackups getBackups() {
|
public @NonNull RegionBackups getBackups() {
|
||||||
return RegionBackups.EMPTY;
|
return RegionBackups.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save() {
|
|
||||||
DynamicRegionRepository.saveRegion(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load(RegionData regionData) {
|
|
||||||
DynamicRegionRepository.loadRegionData(this, regionData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -77,7 +77,7 @@ public class FixedRegionSystem implements RegionSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull Stream<Region> getConnectedRegions(Region region) {
|
public @NonNull Stream<Region> getConnectedRegions(@NonNull Region region) {
|
||||||
return Stream.empty();
|
return Stream.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user