diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/warp/Warp.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/warp/Warp.java index 0417bb28..8b1b1ee7 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/warp/Warp.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/warp/Warp.java @@ -19,6 +19,7 @@ package de.steamwar.bausystem.features.warp; +import de.steamwar.bausystem.region.RegionSystem; import de.steamwar.bausystem.worlddata.WorldData; import lombok.Getter; import org.bukkit.*; @@ -35,8 +36,7 @@ public class Warp { public static void enable() { Warp worldSpawn = new Warp("WorldSpawn"); - Location spawnPoint = Bukkit.getWorlds().get(0).getHighestBlockAt(org.bukkit.Bukkit.getWorlds().get(0).getSpawnLocation()).getLocation(); - worldSpawn.setLocation(spawnPoint.add(0.5, 1, 0.5)); + worldSpawn.setLocation(RegionSystem.INSTANCE.getWorldSpawn()); worldSpawn.setMat(Material.NETHER_STAR); warpMap.put("WorldSpawn", worldSpawn); } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/RegionSystem.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/RegionSystem.java index 4289fb1b..b476bfd2 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/RegionSystem.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/RegionSystem.java @@ -42,6 +42,12 @@ public interface RegionSystem { */ void save(); + /** + * Returns the Location to teleport players to when they first join or Warp to "WorldSpawn" + */ + @NonNull + Location getWorldSpawn(); + /** * Returns the GlobalRegion. This Region should have their {@link Region#getID()} return the * '00000000-0000-0000-0000-000000000000' UUID for easier retrieval with {@link #getRegion(UUID)}. diff --git a/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/region/FixedRegionSystem.java b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/region/FixedRegionSystem.java index 68f3cd18..22ca45c5 100644 --- a/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/region/FixedRegionSystem.java +++ b/BauSystem/BauSystem_RegionFixed/src/de/steamwar/bausystem/region/FixedRegionSystem.java @@ -23,6 +23,7 @@ import de.steamwar.bausystem.region.fixed.FixedGlobalRegion; import de.steamwar.bausystem.region.fixed.loader.PrototypeLoader; import de.steamwar.bausystem.region.fixed.loader.RegionLoader; import lombok.NonNull; +import org.bukkit.Bukkit; import org.bukkit.Location; import java.util.HashMap; @@ -45,6 +46,13 @@ public class FixedRegionSystem implements RegionSystem { public void save() { } + @Override + public @NonNull Location getWorldSpawn() { + Location spawnLocation = Bukkit.getWorlds().get(0).getSpawnLocation(); + Location spawnPoint = Bukkit.getWorlds().get(0).getHighestBlockAt(spawnLocation).getLocation(); + return spawnPoint.add(0.5, 1, 0.5); + } + @Override public Region getGlobalRegion() { return FixedGlobalRegion.INSTANCE;