mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-22 15:31:39 +01:00
Fix spawn location in world config should use SpawnLocation class not bukkit Location
This commit is contained in:
parent
17bb856242
commit
5259f6a503
@ -14,6 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
import org.mvplugins.multiverse.core.configuration.handle.StringPropertyHandle;
|
import org.mvplugins.multiverse.core.configuration.handle.StringPropertyHandle;
|
||||||
import org.mvplugins.multiverse.core.world.config.AllowedPortalType;
|
import org.mvplugins.multiverse.core.world.config.AllowedPortalType;
|
||||||
|
import org.mvplugins.multiverse.core.world.config.SpawnLocation;
|
||||||
import org.mvplugins.multiverse.core.world.config.WorldConfig;
|
import org.mvplugins.multiverse.core.world.config.WorldConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -533,7 +534,7 @@ public class MultiverseWorld {
|
|||||||
*
|
*
|
||||||
* @return The spawn location of this world.
|
* @return The spawn location of this world.
|
||||||
*/
|
*/
|
||||||
public Location getSpawnLocation() {
|
public SpawnLocation getSpawnLocation() {
|
||||||
return worldConfig.getSpawnLocation();
|
return worldConfig.getSpawnLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,6 +545,17 @@ public class MultiverseWorld {
|
|||||||
* @return Result of setting property.
|
* @return Result of setting property.
|
||||||
*/
|
*/
|
||||||
public Try<Void> setSpawnLocation(Location spawnLocation) {
|
public Try<Void> setSpawnLocation(Location spawnLocation) {
|
||||||
|
return setSpawnLocation(new SpawnLocation(spawnLocation));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the spawn location for a world.
|
||||||
|
*
|
||||||
|
* @param spawnLocation The spawn location for a world.
|
||||||
|
* @return Result of setting property.
|
||||||
|
*/
|
||||||
|
public Try<Void> setSpawnLocation(SpawnLocation spawnLocation) {
|
||||||
|
//todo: Maybe check of safe location if adjust spawn is enabled
|
||||||
return worldConfig.setSpawnLocation(spawnLocation);
|
return worldConfig.setSpawnLocation(spawnLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,11 +301,11 @@ public final class WorldConfig {
|
|||||||
return configHandle.set(configNodes.SEED, seed);
|
return configHandle.set(configNodes.SEED, seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getSpawnLocation() {
|
public SpawnLocation getSpawnLocation() {
|
||||||
return configHandle.get(configNodes.SPAWN_LOCATION);
|
return configHandle.get(configNodes.SPAWN_LOCATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Try<Void> setSpawnLocation(Location spawnLocation) {
|
public Try<Void> setSpawnLocation(SpawnLocation spawnLocation) {
|
||||||
return configHandle.set(configNodes.SPAWN_LOCATION, spawnLocation);
|
return configHandle.set(configNodes.SPAWN_LOCATION, spawnLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ public class WorldConfigNodes {
|
|||||||
.name(null)
|
.name(null)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
final ConfigNode<Location> SPAWN_LOCATION = node(ConfigNode.builder("spawn-location", Location.class)
|
final ConfigNode<SpawnLocation> SPAWN_LOCATION = node(ConfigNode.builder("spawn-location", SpawnLocation.class)
|
||||||
.defaultValue(NullLocation.get())
|
.defaultValue(NullLocation.get())
|
||||||
.name(null)
|
.name(null)
|
||||||
.onSetValue((oldValue, newValue) -> {
|
.onSetValue((oldValue, newValue) -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user