Workaround for CraftBukkit bug.
Getting ArrayIndexOutOfBoundsException from one of the API methods.
This commit is contained in:
parent
b0db444315
commit
fa94db82bc
|
|
@ -1591,7 +1591,12 @@ class PlayerEventHandler implements Listener
|
||||||
if(action == Action.LEFT_CLICK_BLOCK && clickedBlock != null)
|
if(action == Action.LEFT_CLICK_BLOCK && clickedBlock != null)
|
||||||
{
|
{
|
||||||
Block adjacentBlock = clickedBlock.getRelative(event.getBlockFace());
|
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(lightLevel == 15 && adjacentBlock.getType() == Material.FIRE)
|
||||||
{
|
{
|
||||||
if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user