Skip to content
Snippets Groups Projects
Commit e8690ce7 authored by Zandor Smith's avatar Zandor Smith :computer:
Browse files

+ Added void protection.

parent 60a7ef86
No related branches found
No related tags found
No related merge requests found
......@@ -87,14 +87,22 @@ public class TorchLight extends JavaPlugin {
state.getLocation().getBlock().setData(state.getData().getData());
}
Location location = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY() - 1, player.getLocation().getZ());
boolean theVoid = false;
while (location.getBlock().getType().equals(Material.AIR) ||
location.getBlock().getType().equals(Material.WATER) ||
location.getBlock().getType().equals(Material.STATIONARY_WATER) ||
location.getBlock().getType().equals(Material.LAVA) ||
location.getBlock().getType().equals(Material.STATIONARY_LAVA))
location.getBlock().getType().equals(Material.STATIONARY_LAVA)) {
location.add(0, -1, 0);
playerState.put(player.getName(), location.getBlock().getState());
location.getBlock().setType(Material.GLOWSTONE);
if(location.getY() <= 1) {
theVoid = true;
break;
}
}
if(!theVoid) {
playerState.put(player.getName(), location.getBlock().getState());
location.getBlock().setType(Material.GLOWSTONE);
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment