Fix Locations

This commit is contained in:
2024-12-13 09:31:15 +01:00
parent e1d3e47845
commit b90884ee1d

View File

@@ -21,6 +21,7 @@ package de.steamwar.tntleague.config
import de.steamwar.tntleague.plugin
import de.steamwar.kotlin.util.Area
import de.steamwar.tntleague.TNTLeague
import net.kyori.adventure.text.Component
import org.bukkit.Location
import org.bukkit.Material
@@ -67,11 +68,11 @@ object TNTLeagueWorldConfig {
) {
companion object {
fun fromConfig(config: ConfigurationSection): TeamConfig {
val spawnLocation = config.getLocation("spawn")!!
val dealerSpawn = config.getLocation("dealerSpawn")!!
val itemSpawn = config.getLocation("itemSpawn")!!
val targetPos1 = config.getLocation("targetMin")!!
val targetPos2 = config.getLocation("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)
@@ -91,3 +92,19 @@ object TNTLeagueWorldConfig {
}
}
}
fun ConfigurationSection.getWorldLocation(s: String): Location {
val section = getConfigurationSection(s)!!
val x = section.getDouble("x")
val y = section.getDouble("y")
val z = section.getDouble("z")
val pitch = section.getDouble("pitch")
val yaw = section.getDouble("yaw")
return Location(
plugin.server.worlds.first(),
x, y, z,
pitch.toFloat(), yaw.toFloat()
)
}