Skip to content

Commit

Permalink
Bug Fix: World -> Spawn-World config option works as intended again
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohron committed Dec 13, 2021
1 parent c9bbd93 commit f65533c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

# Beta 32.1
**REQUIRED: Sponge API 7.3+; Grief Defender 2+; LuckPerms 5.3.X;**
**OPTIONAL: Nucleus 2.3.2+**
- Bug Fix: `World -> Spawn-World` config option works as intended again

# Beta 32 - Grief Defender 2
**REQUIRED: Sponge API 7.3+; Grief Defender 2+; LuckPerms 5.3.X;**
**OPTIONAL: Nucleus 2.3.2+**
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Version
major=0
minor=32
patch=0
patch=1
api=S7.13
suffix=GRIEF-DEFENDER-2-SNAPSHOT
## Dependencies
Expand Down
22 changes: 20 additions & 2 deletions src/main/java/net/mohron/skyclaims/config/type/WorldConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

@ConfigSerializable
public class WorldConfig {

private static final UUID NIL_UUID = new UUID(0, 0);

@Setting(value = "SkyClaims-World-UUID", comment = "Sponge UUID of the world to manage islands in")
Expand Down Expand Up @@ -76,10 +77,27 @@ public World getWorld() {
}
}

public World getSpawnWorld() {
if (!isSeparateSpawn()) {
return getWorld();
}
final Optional<World> world = Sponge.getServer().getWorld(spawnWorld);
if (world.isPresent()) {
return world.get();
} else {
SkyClaims.getInstance().getLogger().error("World \"" + spawnWorld + "\" cannot be found.");
return getWorld();
}
}

public Location<World> getSpawn() {
World world = getWorld();
World world = getSpawnWorld();
SkyClaims.getInstance().getLogger().debug("Spawn World: {}", world.getName());
return world.isLoaded() ? world.getSpawnLocation() : getWorld().getSpawnLocation();
if (!world.isLoaded()) {
SkyClaims.getInstance().getLogger().error("World \"" + spawnWorld + "\" is not loaded.");
return getWorld().getSpawnLocation();
}
return world.getSpawnLocation();
}

public boolean isSeparateSpawn() {
Expand Down

0 comments on commit f65533c

Please sign in to comment.