Developer API

The current API consists of a single event that allows to change which mobs are removed by the plugin. The relevant class is me.filoghost.farmlimiter.api.FarmLimitEvent.



Code example

// Your listener class, remember to register it
public class MyListener implements Listener {

    public void onFarmLimit(FarmLimitEvent event) {
        Collection<LivingEntity> entitiesToRemove = event.getEntitiesToRemove();
        Iterator<LivingEntity> entityIterator = entitiesToRemove.iterator();

        while (entityIterator.hasNext()) {
            LivingEntity entityToRemove =;

            if (entityToRemove.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) {
                // Prevent entities with resistance from being cleaned up by removing them from the event.