feat: 整数座標の補正
This commit is contained in:
parent
643556c0ac
commit
b9afe9bc46
|
|
@ -26,7 +26,19 @@ class App : JavaPlugin(), Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the world's spawn location
|
// 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
|
// Teleport player to spawn immediately
|
||||||
// This happens before the player is fully loaded into the world
|
// This happens before the player is fully loaded into the world
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user