diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2022-11-21 13:33:55 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2022-11-21 13:33:55 -0500 |
commit | 1815b63bc94382a36b610be8082a423364e51b21 (patch) | |
tree | 574ebf7d505b6f1b438765aff6e743c5e972d661 /src/main/java/net/tylermurphy/hideAndSeek/util/Location.java | |
parent | 1.7.0 beta 5 (diff) | |
download | kenshinshideandseek-1815b63bc94382a36b610be8082a423364e51b21.tar.gz kenshinshideandseek-1815b63bc94382a36b610be8082a423364e51b21.tar.bz2 kenshinshideandseek-1815b63bc94382a36b610be8082a423364e51b21.zip |
1.7.0 beta 6
Diffstat (limited to '')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/util/Location.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/util/Location.java b/src/main/java/net/tylermurphy/hideAndSeek/util/Location.java index 2abdb9b..efc4329 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/util/Location.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/util/Location.java @@ -4,6 +4,7 @@ import net.tylermurphy.hideAndSeek.Main; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.WorldCreator; +import org.bukkit.WorldType; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -42,13 +43,30 @@ public class Location { this.z = z; } - public World load() { + public Location(@NotNull String world, @NotNull org.bukkit.Location location) { + this.world = world; + this.x = location.getX(); + this.y = location.getY(); + this.z = location.getZ(); + } + + public World load(WorldType type) { World bukkitWorld = Bukkit.getWorld(world); if(bukkitWorld != null) return bukkitWorld; - Bukkit.getServer().createWorld(new WorldCreator(world)); + if (type == null) { + Bukkit.getServer().createWorld(new WorldCreator(world)); + } else { + Bukkit.getServer().createWorld(new WorldCreator(world).type(type)); + } return Bukkit.getWorld(world); } + public World load() { + if(!exists()) return null; + if(!Main.getInstance().isLoaded()) return null; + return load(null); + } + private org.bukkit.Location toBukkit() { return new org.bukkit.Location( Bukkit.getWorld(world), |