Skip to content

Commit

Permalink
Avoid trap in Spigot for light levels outside max height
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeprimm committed Dec 15, 2014
1 parent b0d9f55 commit 274a363
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/org/dynmap/bukkit/BukkitWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionDefault;
import org.dynmap.DynmapChunk;
Expand Down Expand Up @@ -124,7 +125,10 @@ public boolean isLoaded() {
@Override
public int getLightLevel(int x, int y, int z) {
if(world != null) {
return world.getBlockAt(x, y, z).getLightLevel();
if ((y >= 0) && (y < this.worldheight)) {
return world.getBlockAt(x, y, z).getLightLevel();
}
return 0;
}
else {
return -1;
Expand All @@ -149,7 +153,12 @@ public boolean canGetSkyLightLevel() {
@Override
public int getSkyLightLevel(int x, int y, int z) {
if(world != null) {
return world.getBlockAt(x, y, z).getLightFromSky();
if ((y >= 0) && (y < this.worldheight)) {
return world.getBlockAt(x, y, z).getLightFromSky();
}
else {
return 15;
}
}
else {
return -1;
Expand Down

0 comments on commit 274a363

Please sign in to comment.