From 746137b8f212fcf981dc83043b202b026930a0b5 Mon Sep 17 00:00:00 2001 From: Fabrizio La Rosa Date: Thu, 2 Jul 2020 05:17:01 +0200 Subject: [PATCH] Fixed error in storage permission --- .../listening/StoragePermission.java | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) 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