mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-30 11:17:14 -05:00
Fixes for respawn system
This commit is contained in:
parent
75b12abe0b
commit
be2cc420a2
2 changed files with 12 additions and 10 deletions
|
@ -258,12 +258,13 @@ class CommandSpawn implements CommandExecutor {
|
|||
World world = Bukkit.getWorld("world");
|
||||
Location spawnLoc = world.getSpawnLocation();
|
||||
|
||||
for (double y = spawnLoc.getY(); y <= 257; y++) {
|
||||
Block coordBlock = world.getBlockAt(new Location(world, spawnLoc.getX(), y, spawnLoc.getZ()));
|
||||
for (double y = spawnLoc.getY(); y <= 256; y++) {
|
||||
Location yLoc = new Location(world, spawnLoc.getX(), y, spawnLoc.getZ());
|
||||
Block coordBlock = world.getBlockAt(yLoc);
|
||||
|
||||
if (coordBlock.getType() == Material.AIR &&
|
||||
coordBlock.getRelative(BlockFace.UP).getType() == Material.AIR) {
|
||||
player.teleport(spawnLoc.add(0, y - spawnLoc.getY(), 0));
|
||||
if (coordBlock.getType().isTransparent() &&
|
||||
coordBlock.getRelative(BlockFace.UP).getType().isTransparent()) {
|
||||
player.teleport(yLoc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -619,12 +619,13 @@ class Events implements Listener {
|
|||
World world = Bukkit.getWorld("world");
|
||||
Location spawnLoc = world.getSpawnLocation();
|
||||
|
||||
for (double y = spawnLoc.getY(); y <= 257; y++) {
|
||||
Block coordBlock = world.getBlockAt(new Location(world, spawnLoc.getX(), y, spawnLoc.getZ()));
|
||||
for (double y = spawnLoc.getY(); y <= 256; y++) {
|
||||
Location yLoc = new Location(world, spawnLoc.getX(), y, spawnLoc.getZ());
|
||||
Block coordBlock = world.getBlockAt(yLoc);
|
||||
|
||||
if (coordBlock.getType() == Material.AIR &&
|
||||
coordBlock.getRelative(BlockFace.UP).getType() == Material.AIR) {
|
||||
player.teleport(spawnLoc.add(0, y - spawnLoc.getY(), 0));
|
||||
if (coordBlock.getType().isTransparent() &&
|
||||
coordBlock.getRelative(BlockFace.UP).getType().isTransparent()) {
|
||||
player.teleport(yLoc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue