Fix Locations

This commit is contained in:
2024-12-13 09:43:18 +01:00
parent b90884ee1d
commit 56c66b33b7
@@ -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")