forked from SteamWar/SteamWar
Improve some stuff
This commit is contained in:
+1
@@ -55,6 +55,7 @@ public abstract class DynamicRegion implements Region {
|
||||
this.minX = regionConstructorData.minX;
|
||||
this.minZ = regionConstructorData.minZ;
|
||||
backups = RegionDataRepository.getBackups(this);
|
||||
RegionDataRepository.saveRegion(this);
|
||||
DynamicRegionSystem.INSTANCE.add(this);
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -39,9 +39,9 @@ public class RegionConstructorData {
|
||||
public final int minX;
|
||||
public final int minZ;
|
||||
|
||||
public RegionConstructorData(JsonObject jsonObject) {
|
||||
public RegionConstructorData(JsonObject jsonObject, UUID uuid) {
|
||||
regionClass = jsonObject.get("regionClass").getAsString();
|
||||
uuid = UUID.fromString(jsonObject.get("uuid").getAsString());
|
||||
this.uuid = uuid;
|
||||
minX = jsonObject.get("minX").getAsInt();
|
||||
minZ = jsonObject.get("minZ").getAsInt();
|
||||
}
|
||||
@@ -53,7 +53,6 @@ public class RegionConstructorData {
|
||||
writer.setIndent(" ");
|
||||
writer.beginObject();
|
||||
writer.name("regionClass").value(regionClass);
|
||||
writer.name("uuid").value(uuid.toString());
|
||||
writer.name("minX").value(minX);
|
||||
writer.name("minZ").value(minZ);
|
||||
writer.endObject();
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ public class RegionDataRepository {
|
||||
File metaFile = new File(file, META_FILE_NAME);
|
||||
if (!metaFile.exists()) continue;
|
||||
JsonObject jsonObject = JsonParser.parseReader(new FileReader(metaFile)).getAsJsonObject();
|
||||
RegionConstructorData regionConstructorData = new RegionConstructorData(jsonObject);
|
||||
RegionConstructorData regionConstructorData = new RegionConstructorData(jsonObject, UUID.fromString(file.getName()));
|
||||
Function<RegionConstructorData, DynamicRegion> constructor = regionCreators.get(regionConstructorData.regionClass);
|
||||
if (constructor == null) continue;
|
||||
regions.add(constructor.apply(regionConstructorData));
|
||||
|
||||
+4
@@ -58,6 +58,8 @@ public class SpawnResetter {
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (neighbours.size() == 8) {
|
||||
Bukkit.getWorlds().get(0).setSpawnLocation(BIG_WORLD_SPAWN);
|
||||
|
||||
Region.Area area = spawnRegion.getArea();
|
||||
Point minPoint = area.getMinPoint(false).subtract(19, 0, 19);
|
||||
Clipboard clipboard = FlatteningWrapper.impl.loadSchematic(RESET_FILE);
|
||||
@@ -74,6 +76,8 @@ public class SpawnResetter {
|
||||
}
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
Bukkit.getWorlds().get(0).setSpawnLocation(SMALL_WORLD_SPAWN);
|
||||
}
|
||||
|
||||
internalReset(spawnRegion, spawnRegion != region);
|
||||
|
||||
Reference in New Issue
Block a user