Do not apply spawn location if it's a null location

This commit is contained in:
Ben Woo 2023-09-11 16:39:34 +08:00
parent c2ff8a467f
commit ef0cb4b893
No known key found for this signature in database
GPG Key ID: FB2A3645536E12C8

View File

@ -1,6 +1,5 @@
package com.onarandombox.MultiverseCore.worldnew.config; package com.onarandombox.MultiverseCore.worldnew.config;
import com.onarandombox.MultiverseCore.config.MVCoreConfig;
import com.onarandombox.MultiverseCore.configuration.node.ConfigNode; import com.onarandombox.MultiverseCore.configuration.node.ConfigNode;
import com.onarandombox.MultiverseCore.configuration.node.Node; import com.onarandombox.MultiverseCore.configuration.node.Node;
import com.onarandombox.MultiverseCore.configuration.node.NodeGroup; import com.onarandombox.MultiverseCore.configuration.node.NodeGroup;
@ -175,9 +174,10 @@ public class WorldConfigNodes {
.name(null) .name(null)
.onSetValue((oldValue, newValue) -> { .onSetValue((oldValue, newValue) -> {
if (world == null) return; if (world == null) return;
world.getBukkitWorld().peek(world -> { if (newValue == null || newValue instanceof NullLocation) return;
world.setSpawnLocation(newValue.getBlockX(), newValue.getBlockY(), newValue.getBlockZ()); world.getBukkitWorld().peek(bukkitWorld -> {
newValue.setWorld(world); bukkitWorld.setSpawnLocation(newValue.getBlockX(), newValue.getBlockY(), newValue.getBlockZ());
newValue.setWorld(bukkitWorld);
}); });
}) })
.build()); .build());