feat: 整数座標の補正

This commit is contained in:
Keisuke Hirata 2025-12-09 07:19:34 +09:00
parent 643556c0ac
commit b9afe9bc46

View File

@ -26,7 +26,19 @@ class App : JavaPlugin(), Listener {
}
// Get the world's spawn location
val spawnLocation = player.world.spawnLocation
val spawnLocation = player.world.spawnLocation.clone()
// Add 0.5 to X and Z coordinates if they are whole numbers
// This centers the player on the block
val x = spawnLocation.x
val z = spawnLocation.z
if (x == x.toInt().toDouble()) {
spawnLocation.x = x + 0.5
}
if (z == z.toInt().toDouble()) {
spawnLocation.z = z + 0.5
}
// Teleport player to spawn immediately
// This happens before the player is fully loaded into the world