Skip to content

Commit 5259f6a

Browse files
committed
Fix spawn location in world config should use SpawnLocation class not bukkit Location
1 parent 17bb856 commit 5259f6a

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/main/java/org/mvplugins/multiverse/core/world/MultiverseWorld.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import org.mvplugins.multiverse.core.configuration.handle.StringPropertyHandle;
1616
import org.mvplugins.multiverse.core.world.config.AllowedPortalType;
17+
import org.mvplugins.multiverse.core.world.config.SpawnLocation;
1718
import org.mvplugins.multiverse.core.world.config.WorldConfig;
1819

1920
/**
@@ -533,7 +534,7 @@ public long getSeed() {
533534
*
534535
* @return The spawn location of this world.
535536
*/
536-
public Location getSpawnLocation() {
537+
public SpawnLocation getSpawnLocation() {
537538
return worldConfig.getSpawnLocation();
538539
}
539540

@@ -544,6 +545,17 @@ public Location getSpawnLocation() {
544545
* @return Result of setting property.
545546
*/
546547
public Try<Void> setSpawnLocation(Location spawnLocation) {
548+
return setSpawnLocation(new SpawnLocation(spawnLocation));
549+
}
550+
551+
/**
552+
* Sets the spawn location for a world.
553+
*
554+
* @param spawnLocation The spawn location for a world.
555+
* @return Result of setting property.
556+
*/
557+
public Try<Void> setSpawnLocation(SpawnLocation spawnLocation) {
558+
//todo: Maybe check of safe location if adjust spawn is enabled
547559
return worldConfig.setSpawnLocation(spawnLocation);
548560
}
549561

src/main/java/org/mvplugins/multiverse/core/world/config/WorldConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,11 @@ public Try<Void> setSeed(long seed) {
301301
return configHandle.set(configNodes.SEED, seed);
302302
}
303303

304-
public Location getSpawnLocation() {
304+
public SpawnLocation getSpawnLocation() {
305305
return configHandle.get(configNodes.SPAWN_LOCATION);
306306
}
307307

308-
public Try<Void> setSpawnLocation(Location spawnLocation) {
308+
public Try<Void> setSpawnLocation(SpawnLocation spawnLocation) {
309309
return configHandle.set(configNodes.SPAWN_LOCATION, spawnLocation);
310310
}
311311

src/main/java/org/mvplugins/multiverse/core/world/config/WorldConfigNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ private <N extends Node> N node(N node) {
186186
.name(null)
187187
.build());
188188

189-
final ConfigNode<Location> SPAWN_LOCATION = node(ConfigNode.builder("spawn-location", Location.class)
189+
final ConfigNode<SpawnLocation> SPAWN_LOCATION = node(ConfigNode.builder("spawn-location", SpawnLocation.class)
190190
.defaultValue(NullLocation.get())
191191
.name(null)
192192
.onSetValue((oldValue, newValue) -> {

0 commit comments

Comments
 (0)