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;
if(action == Action.LEFT_CLICK_BLOCK && clickedBlock != null)
{
Block adjacentBlock = clickedBlock.getRelative(event.getBlockFace());
byte lightLevel = 15;
try
if(clickedBlock.getY() < clickedBlock.getWorld().getMaxHeight() - 1 || event.getBlockFace() != BlockFace.UP)
{
lightLevel = adjacentBlock.getLightFromBlocks();
}
catch(ArrayIndexOutOfBoundsException e){ } //assume default value of 15 to work around a craftbukkit bug
Block adjacentBlock = clickedBlock.getRelative(event.getBlockFace());
byte lightLevel = adjacentBlock.getLightFromBlocks();
if(lightLevel == 15 && adjacentBlock.getType() == Material.FIRE)
{
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
if(!this.onLeftClickWatchList(clickedBlockType) && !GriefPrevention.instance.config_mods_accessTrustIds.Contains(new MaterialInfo(clickedBlock.getTypeId(), clickedBlock.getData(), null)))