My Code:
Java:
class PlayerJoinListener: Listener {
@EventHandler
fun playerJoinEvent(event: PlayerJoinEvent) {
val player = event.player
val joinMsg = Component.text("§f[§a+§f] §f ${player.name()}")
event.joinMessage(joinMsg)
val config = Bukkit.getPluginManager().getPlugin("AlpineMC")?.config!!
if (config.getBoolean("serverSpawn.enabled")) {
val worldName = config.getString("serverSpawn.world")
val world = Bukkit.getWorld(worldName!!)
val x = config.getDouble("serverSpawn.x")
val y = config.getDouble("serverSpawn.y")
val z = config.getDouble("serverSpawn.z")
val yaw = config.getDouble("serverSpawn.yaw")
val pitch = config.getDouble("serverSpawn.pitch")
val location = Location(world, x, y, z, yaw.toFloat(), pitch.toFloat())
player.teleport(location)
}
}
}
- Version Output
- 1.20.1 build 117