Reworked previous "workaround for craftbukkit bug".

Now with better understanding of root cause.
This commit is contained in:
ryanhamshire 2016-05-05 08:24:21 -07:00
parent 124f20753f
commit 4d9175e9a9

View File

@ -1590,13 +1590,10 @@ class PlayerEventHandler implements Listener
PlayerData playerData = null; PlayerData playerData = null;
if(action == Action.LEFT_CLICK_BLOCK && clickedBlock != null) if(action == Action.LEFT_CLICK_BLOCK && clickedBlock != null)
{ {
Block adjacentBlock = clickedBlock.getRelative(event.getBlockFace()); if(clickedBlock.getY() < clickedBlock.getWorld().getMaxHeight() - 1 || event.getBlockFace() != BlockFace.UP)
byte lightLevel = 15;
try
{ {
lightLevel = adjacentBlock.getLightFromBlocks(); Block adjacentBlock = clickedBlock.getRelative(event.getBlockFace());
} byte lightLevel = adjacentBlock.getLightFromBlocks();
catch(ArrayIndexOutOfBoundsException e){ } //assume default value of 15 to work around a craftbukkit bug
if(lightLevel == 15 && adjacentBlock.getType() == Material.FIRE) if(lightLevel == 15 && adjacentBlock.getType() == Material.FIRE)
{ {
if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId()); if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
@ -1615,6 +1612,7 @@ class PlayerEventHandler implements Listener
} }
} }
} }
}
//exception for blocks on a specific watch list //exception for blocks on a specific watch list
if(!this.onLeftClickWatchList(clickedBlockType) && !GriefPrevention.instance.config_mods_accessTrustIds.Contains(new MaterialInfo(clickedBlock.getTypeId(), clickedBlock.getData(), null))) if(!this.onLeftClickWatchList(clickedBlockType) && !GriefPrevention.instance.config_mods_accessTrustIds.Contains(new MaterialInfo(clickedBlock.getTypeId(), clickedBlock.getData(), null)))