Workaround for CraftBukkit bug.

Getting ArrayIndexOutOfBoundsException from one of the API methods.
This commit is contained in:
ryanhamshire 2016-04-27 20:11:42 -07:00
parent b0db444315
commit fa94db82bc

View File

@ -1591,7 +1591,12 @@ class PlayerEventHandler implements Listener
if(action == Action.LEFT_CLICK_BLOCK && clickedBlock != null)
{
Block adjacentBlock = clickedBlock.getRelative(event.getBlockFace());
byte lightLevel = adjacentBlock.getLightFromBlocks();
byte lightLevel = 15;
try
{
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(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());