mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-27 09:55:36 -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");
|
World world = Bukkit.getWorld("world");
|
||||||
Location spawnLoc = world.getSpawnLocation();
|
Location spawnLoc = world.getSpawnLocation();
|
||||||
|
|
||||||
for (double y = spawnLoc.getY(); y <= 257; y++) {
|
for (double y = spawnLoc.getY(); y <= 256; y++) {
|
||||||
Block coordBlock = world.getBlockAt(new Location(world, spawnLoc.getX(), y, spawnLoc.getZ()));
|
Location yLoc = new Location(world, spawnLoc.getX(), y, spawnLoc.getZ());
|
||||||
|
Block coordBlock = world.getBlockAt(yLoc);
|
||||||
|
|
||||||
if (coordBlock.getType() == Material.AIR &&
|
if (coordBlock.getType().isTransparent() &&
|
||||||
coordBlock.getRelative(BlockFace.UP).getType() == Material.AIR) {
|
coordBlock.getRelative(BlockFace.UP).getType().isTransparent()) {
|
||||||
player.teleport(spawnLoc.add(0, y - spawnLoc.getY(), 0));
|
player.teleport(yLoc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -619,12 +619,13 @@ class Events implements Listener {
|
||||||
World world = Bukkit.getWorld("world");
|
World world = Bukkit.getWorld("world");
|
||||||
Location spawnLoc = world.getSpawnLocation();
|
Location spawnLoc = world.getSpawnLocation();
|
||||||
|
|
||||||
for (double y = spawnLoc.getY(); y <= 257; y++) {
|
for (double y = spawnLoc.getY(); y <= 256; y++) {
|
||||||
Block coordBlock = world.getBlockAt(new Location(world, spawnLoc.getX(), y, spawnLoc.getZ()));
|
Location yLoc = new Location(world, spawnLoc.getX(), y, spawnLoc.getZ());
|
||||||
|
Block coordBlock = world.getBlockAt(yLoc);
|
||||||
|
|
||||||
if (coordBlock.getType() == Material.AIR &&
|
if (coordBlock.getType().isTransparent() &&
|
||||||
coordBlock.getRelative(BlockFace.UP).getType() == Material.AIR) {
|
coordBlock.getRelative(BlockFace.UP).getType().isTransparent()) {
|
||||||
player.teleport(spawnLoc.add(0, y - spawnLoc.getY(), 0));
|
player.teleport(yLoc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue