mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-23 18:55:30 +01:00
Refactored Storage permission
This commit is contained in:
parent
7c0460bd06
commit
c73612de87
@ -7,6 +7,7 @@ import com.songoda.skyblock.message.MessageManager;
|
|||||||
import com.songoda.skyblock.permission.ListeningPermission;
|
import com.songoda.skyblock.permission.ListeningPermission;
|
||||||
import com.songoda.skyblock.permission.PermissionHandler;
|
import com.songoda.skyblock.permission.PermissionHandler;
|
||||||
import com.songoda.skyblock.permission.PermissionType;
|
import com.songoda.skyblock.permission.PermissionType;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.minecart.StorageMinecart;
|
import org.bukkit.entity.minecart.StorageMinecart;
|
||||||
@ -27,31 +28,44 @@ public class StoragePermission extends ListeningPermission {
|
|||||||
|
|
||||||
@PermissionHandler
|
@PermissionHandler
|
||||||
public void onInteract(PlayerInteractEvent event) {
|
public void onInteract(PlayerInteractEvent event) {
|
||||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock());
|
CompatibleMaterial material = CompatibleMaterial.getMaterial(event.getClickedBlock());
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (material == CompatibleMaterial.CHEST || material == CompatibleMaterial.TRAPPED_CHEST
|
switch (material){
|
||||||
|| (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9) && (material == CompatibleMaterial.SHULKER_BOX
|
case CHEST:
|
||||||
|| material == CompatibleMaterial.BLACK_SHULKER_BOX || material == CompatibleMaterial.BLUE_SHULKER_BOX
|
case TRAPPED_CHEST:
|
||||||
|| material == CompatibleMaterial.BROWN_SHULKER_BOX || material == CompatibleMaterial.CYAN_SHULKER_BOX
|
case DROPPER:
|
||||||
|| material == CompatibleMaterial.GRAY_SHULKER_BOX || material == CompatibleMaterial.GREEN_SHULKER_BOX
|
case DISPENSER:
|
||||||
|| material == CompatibleMaterial.LIGHT_BLUE_SHULKER_BOX || material == CompatibleMaterial.LIGHT_GRAY_SHULKER_BOX
|
case SHULKER_BOX:
|
||||||
|| material == CompatibleMaterial.LIME_SHULKER_BOX || material == CompatibleMaterial.MAGENTA_SHULKER_BOX
|
case BLACK_SHULKER_BOX:
|
||||||
|| material == CompatibleMaterial.ORANGE_SHULKER_BOX || material == CompatibleMaterial.PINK_SHULKER_BOX
|
case BLUE_SHULKER_BOX:
|
||||||
|| material == CompatibleMaterial.PURPLE_SHULKER_BOX || material == CompatibleMaterial.RED_SHULKER_BOX
|
case BROWN_SHULKER_BOX:
|
||||||
|| material == CompatibleMaterial.WHITE_SHULKER_BOX || material == CompatibleMaterial.YELLOW_SHULKER_BOX))
|
case CYAN_SHULKER_BOX:
|
||||||
|| ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14) && material == CompatibleMaterial.BARREL)
|
case GRAY_SHULKER_BOX:
|
||||||
cancelAndMessage(event, player, plugin, messageManager);
|
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
|
@PermissionHandler
|
||||||
public void onInteractEntity(PlayerInteractEntityEvent event) {
|
public void onInteractEntity(PlayerInteractEntityEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (event.getRightClicked().getType() == EntityType.ITEM_FRAME
|
if (event.getRightClicked().getType().equals(EntityType.ITEM_FRAME)
|
||||||
|| event.getRightClicked() instanceof StorageMinecart)
|
|| event.getRightClicked() instanceof StorageMinecart)
|
||||||
cancelAndMessage(event, player, plugin, messageManager);
|
cancelAndMessage(event, player, plugin, messageManager);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user