diff --git a/src/de/steamwar/lobby/Config.java b/src/de/steamwar/lobby/Config.java index 15ad255..f3685e5 100644 --- a/src/de/steamwar/lobby/Config.java +++ b/src/de/steamwar/lobby/Config.java @@ -26,6 +26,12 @@ import org.bukkit.configuration.serialization.ConfigurationSerialization; public class Config { + public static double SpawnX = 0; + public static double SpawnY = 0; + public static double SpawnZ = 0; + public static float Pitch = 0; + public static float Yaw = 0; + static { ConfigurationSerialization.registerClass(Portal.class); ConfigurationSerialization.registerClass(Hologram.class); @@ -38,12 +44,24 @@ public class Config { yml.getList("portals", Portal.getPortals()); yml.getList("holograms", Hologram.getHolograms()); + + SpawnX = yml.getDouble("SpawnX"); + SpawnY = yml.getDouble("SpawnY"); + SpawnZ = yml.getDouble("SpawnZ"); + Pitch = (float) yml.getDouble("Pitch"); + Yaw = (float) yml.getDouble("Yaw"); } public void save() { yml.set("portals", Portal.getPortals()); yml.set("holograms", Hologram.getHolograms()); + yml.set("SpawnX", 0); + yml.set("SpawnY", 0); + yml.set("SpawnZ", 0); + yml.set("Pitch", 0); + yml.set("Yaw", 0); + LobbySystem.getPlugin().saveConfig(); } } diff --git a/src/de/steamwar/lobby/listener/PlayerConnection.java b/src/de/steamwar/lobby/listener/PlayerConnection.java index 1026d69..071bf98 100644 --- a/src/de/steamwar/lobby/listener/PlayerConnection.java +++ b/src/de/steamwar/lobby/listener/PlayerConnection.java @@ -20,6 +20,7 @@ package de.steamwar.lobby.listener; import de.steamwar.comms.packets.ImALobbyPacket; +import de.steamwar.lobby.Config; import de.steamwar.lobby.LobbySystem; import de.steamwar.lobby.inventories.LobbyInventory; import de.steamwar.lobby.util.LobbyPlayer; @@ -42,12 +43,8 @@ public class PlayerConnection extends BasicListener { player.setGameMode(GameMode.ADVENTURE); player.setWalkSpeed(0.5f); - LobbyPlayer.getLobbyPlayer(player.getUniqueId()); //initialisiert einen neuen LP falls nicht vorhanden - - //TODO: Config - player.teleport(new Location(Bukkit.getWorlds().get(0), 0, 60, 0, 0, 0)); - + player.teleport(new Location(Bukkit.getWorlds().get(0), Config.SpawnX, Config.SpawnY, Config.SpawnZ, Config.Yaw, Config.Pitch)); player.getInventory().clear(); LobbyInventory.givePlayerLobbyItems(player); player.setGameMode(GameMode.ADVENTURE);