mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-10 10:17:41 +01:00
Cleanup adjust spawn logic
This commit is contained in:
parent
a4a5be20f9
commit
404a2f4183
@ -60,11 +60,13 @@ public class LoadedMultiverseWorld extends MultiverseWorld {
|
||||
}
|
||||
|
||||
private Location readSpawnFromWorld(World world) {
|
||||
// TODO: Refactor... this is copy pasted and bad
|
||||
Location location = world.getSpawnLocation();
|
||||
// Set the worldspawn to our configspawn
|
||||
|
||||
// Verify that location was safe
|
||||
if (!blockSafety.playerCanSpawnHereSafely(location)) {
|
||||
if (blockSafety.playerCanSpawnHereSafely(location)) {
|
||||
return location;
|
||||
}
|
||||
|
||||
if (!this.getAdjustSpawn()) {
|
||||
Logging.fine("Spawn location from world.dat file was unsafe!!");
|
||||
Logging.fine("NOT adjusting spawn for '" + this.getAlias() + "' because you told me not to.");
|
||||
@ -72,7 +74,8 @@ public class LoadedMultiverseWorld extends MultiverseWorld {
|
||||
Logging.fine("/mvm set adjustspawn true " + this.getAlias());
|
||||
return location;
|
||||
}
|
||||
// If it's not, find a better one.
|
||||
|
||||
// The location is not safe, so we need to find a better one.
|
||||
Logging.warning("Spawn location from world.dat file was unsafe. Adjusting...");
|
||||
Logging.warning("Original Location: " + locationManipulation.strCoordsRaw(location));
|
||||
Location newSpawn = safeTTeleporter.getSafeLocation(location,
|
||||
@ -84,19 +87,19 @@ public class LoadedMultiverseWorld extends MultiverseWorld {
|
||||
Logging.info("New Spawn for '%s' is located at: %s",
|
||||
this.getName(), locationManipulation.locationToString(newSpawn));
|
||||
return newSpawn;
|
||||
} else {
|
||||
}
|
||||
|
||||
// If it's a standard end world, let's check in a better place:
|
||||
Logging.fine("Checking for a safe location using top block...");
|
||||
Location newerSpawn;
|
||||
newerSpawn = blockSafety.getTopBlock(new Location(world, 0, 0, 0));
|
||||
if (newerSpawn != null) {
|
||||
Logging.info("New Spawn for '%s' is located at: %s",
|
||||
this.getName(), locationManipulation.locationToString(newerSpawn));
|
||||
return newerSpawn;
|
||||
} else {
|
||||
}
|
||||
|
||||
Logging.severe("Safe spawn NOT found!!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user