mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-27 12:38:40 +01:00
Add a prevention from IOUB-exceptions
This commit is contained in:
parent
9dae38593d
commit
7c5ed4781f
@ -26,6 +26,7 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.material.Directional;
|
||||
import org.bukkit.material.PistonBaseMaterial;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -58,6 +59,12 @@ public class SignBreak implements Listener {
|
||||
Block attachedBlock = BlockUtil.getAttachedFace(sign);
|
||||
|
||||
if (attachedBlock.getType() == Material.AIR && ChestShopSign.isValid(sign)) {
|
||||
List <MetadataValue> values = block.getMetadata(METADATA_NAME);
|
||||
|
||||
if (values.size() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
sendShopDestroyedEvent(sign, (Player) block.getMetadata(METADATA_NAME).get(0).value());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user