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
}
}`