Fix ShopDestroyEvent not getting called in certain cases

This could be triggered by updating a column of physics blocks with a shop attached
This commit is contained in:
Phoenix616 2019-04-01 13:55:21 +01:00
parent be5f47cb1f
commit 2007c4a7fb
1 changed files with 3 additions and 5 deletions

View File

@ -53,11 +53,9 @@ public class SignBreak implements Listener {
Block attachedBlock = BlockUtil.getAttachedBlock(sign);
if (attachedBlock.getType() == Material.AIR && ChestShopSign.isValid(sign)) {
if (!block.hasMetadata(METADATA_NAME)) {
return;
}
sendShopDestroyedEvent(sign, (Player) block.getMetadata(METADATA_NAME).get(0).value());
sendShopDestroyedEvent(sign, block.hasMetadata(METADATA_NAME)
? (Player) block.getMetadata(METADATA_NAME).get(0).value()
: null);
}
}