diff --git a/src/main/java/com/songoda/skyblock/permission/permissions/listening/StoragePermission.java b/src/main/java/com/songoda/skyblock/permission/permissions/listening/StoragePermission.java index 454ed98e..684ac8b3 100644 --- a/src/main/java/com/songoda/skyblock/permission/permissions/listening/StoragePermission.java +++ b/src/main/java/com/songoda/skyblock/permission/permissions/listening/StoragePermission.java @@ -28,37 +28,39 @@ public class StoragePermission extends ListeningPermission { @PermissionHandler public void onInteract(PlayerInteractEvent event) { - if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) - return; - - CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock()); - Player player = event.getPlayer(); - - switch (material){ - case CHEST: - case TRAPPED_CHEST: - case DROPPER: - case DISPENSER: - case SHULKER_BOX: - case BLACK_SHULKER_BOX: - case BLUE_SHULKER_BOX: - case BROWN_SHULKER_BOX: - case CYAN_SHULKER_BOX: - case GRAY_SHULKER_BOX: - case GREEN_SHULKER_BOX: - case LIGHT_BLUE_SHULKER_BOX: - case LIGHT_GRAY_SHULKER_BOX: - case LIME_SHULKER_BOX: - case MAGENTA_SHULKER_BOX: - case ORANGE_SHULKER_BOX: - case PURPLE_SHULKER_BOX: - case PINK_SHULKER_BOX: - case RED_SHULKER_BOX: - case YELLOW_SHULKER_BOX: - case WHITE_SHULKER_BOX: - case BARREL: - cancelAndMessage(event, player, plugin, messageManager); + if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { + CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock()); + Player player = event.getPlayer(); + + if (material != null) { + switch (material) { + case CHEST: + case TRAPPED_CHEST: + case DROPPER: + case DISPENSER: + case SHULKER_BOX: + case BLACK_SHULKER_BOX: + case BLUE_SHULKER_BOX: + case BROWN_SHULKER_BOX: + case CYAN_SHULKER_BOX: + case GRAY_SHULKER_BOX: + case GREEN_SHULKER_BOX: + case LIGHT_BLUE_SHULKER_BOX: + case LIGHT_GRAY_SHULKER_BOX: + case LIME_SHULKER_BOX: + case MAGENTA_SHULKER_BOX: + case ORANGE_SHULKER_BOX: + case PURPLE_SHULKER_BOX: + case PINK_SHULKER_BOX: + case RED_SHULKER_BOX: + case YELLOW_SHULKER_BOX: + case WHITE_SHULKER_BOX: + case BARREL: + cancelAndMessage(event, player, plugin, messageManager); + } + } } + } @PermissionHandler