I am writing a plugin, and, so far, I am able to disable endermen from breaking and placing blocks, but I cannot disable them picking the blocks up.
Here is my code:
@Listener
public void onBlockBreak(final ChangeBlockEvent event) {
if(event.getCause().root() instanceof Enderman) {
event.setCancelled(true);
event.getTransactions().forEach(t->t.setValid(false));
logger.info(":::: prevented an enderthief!");
}
}