Cancel ItemMoveEvent with Pickaxes in Ender chests?

Status
This thread has been locked.

PurrfectMistake

¬ Owner of AetherTale.com
Premium
Feedback score
10
Posts
307
Reactions
95
Resources
0
Why isn't this working?
Code:
        @EventHandler
        public void pickaxe(InventoryMoveItemEvent event){
            Player p = (Player) event.getSource().getHolder();
            if(p.getInventory().getType().equals(InventoryType.ENDER_CHEST) &&
                    event.getItem().equals(Material.DIAMOND_PICKAXE) || (event.getItem().equals(Material.GOLD_PICKAXE) || (event.getItem().equals(Material.IRON_PICKAXE)
                        || (event.getItem().equals(Material.STONE_PICKAXE) || (event.getItem().equals(Material.WOOD_PICKAXE)))))){
                event.setCancelled(true);
                p.sendMessage(Configuration.pluginprefix + " You can't store pickaxes in enderchests.. try putting it in your cell!");;
              
            }
        }
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Tabuu

Developer
Supreme
Feedback score
3
Posts
39
Reactions
19
Resources
0
Player#getInventory always returns an inventory of type PLAYER. If you want to check if the player has an enderchest opened you could use Player#getOpenInventory.
 
Status
This thread has been locked.
Top