#Need Help with simple pickup events

1 messages · Page 1 of 1 (latest)

lilac temple
#

So I am trying to make it so only villagers can pickup items, other mobs simply cant. I have this code but it does not seem to work

    public void onEnable() {
        // Plugin startup logic

    }
    @EventHandler
    public void onEntityPickupItemEvent(EntityPickupItemEvent e) {
        if (!e.getEntityType().equals(EntityType.VILLAGER))
            e.setCancelled(true);
        }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}`