Fixed error in storage permission

This commit is contained in:
Fabrizio La Rosa 2020-07-02 05:17:01 +02:00
parent d91b0f2768
commit 746137b8f2

View File

@ -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