diff --git a/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueWorldConfig.kt b/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueWorldConfig.kt index 979904f3..81c314be 100644 --- a/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueWorldConfig.kt +++ b/TNTLeague/src/de/steamwar/tntleague/config/TNTLeagueWorldConfig.kt @@ -54,7 +54,7 @@ object TNTLeagueWorldConfig { val blueTeam: TeamConfig = TeamConfig.fromConfig(config.getConfigurationSection("blueTeam")!!) val redTeam: TeamConfig = TeamConfig.fromConfig(config.getConfigurationSection("redTeam")!!) - val lobby: Location = config.getLocation("lobby", blueTeam.spawnLocation.clone().add(redTeam.spawnLocation).multiply(0.5))!! + val lobby: Location = config.getWorldLocation("lobby", blueTeam.spawnLocation.clone().add(redTeam.spawnLocation).multiply(0.5))!! val targetMaterial: Material = Material.matchMaterial(config.getString("targetMaterial", "IRON_BLOCK")!!)!! val minHeight: Int = config.getInt("minHeight", 0) val target: Int = config.getInt("target", -1) @@ -68,11 +68,11 @@ object TNTLeagueWorldConfig { ) { companion object { fun fromConfig(config: ConfigurationSection): TeamConfig { - val spawnLocation = config.getWorldLocation("spawn")!! - val dealerSpawn = config.getWorldLocation("dealerSpawn")!! - val itemSpawn = config.getWorldLocation("itemSpawn")!! - val targetPos1 = config.getWorldLocation("targetMin")!! - val targetPos2 = config.getWorldLocation("targetMax")!! + val spawnLocation = config.getWorldLocation("spawn") + val dealerSpawn = config.getWorldLocation("dealerSpawn") + val itemSpawn = config.getWorldLocation("itemSpawn") + val targetPos1 = config.getWorldLocation("targetMin") + val targetPos2 = config.getWorldLocation("targetMax") spawnDealer(dealerSpawn) @@ -93,8 +93,8 @@ object TNTLeagueWorldConfig { } } -fun ConfigurationSection.getWorldLocation(s: String): Location { - val section = getConfigurationSection(s)!! +fun ConfigurationSection.getWorldLocation(s: String, default: Location? = null): Location { + val section = getConfigurationSection(s) ?: return default!! val x = section.getDouble("x") val y = section.getDouble("y")