All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.nukkit.entity.ai.evaluator.AnyMatchEvaluator Maven / Gradle / Ivy

There is a newer version: 1.20.40-r1
Show newest version
package cn.nukkit.entity.ai.evaluator;

import cn.nukkit.api.PowerNukkitXOnly;
import cn.nukkit.api.Since;
import cn.nukkit.entity.EntityIntelligent;
import org.jetbrains.annotations.NotNull;

import java.util.Set;

@PowerNukkitXOnly
@Since("1.6.0.0-PNX")
public class AnyMatchEvaluator extends MultiBehaviorEvaluator {

    public AnyMatchEvaluator(@NotNull Set evaluators) {
        super(evaluators);
    }

    public AnyMatchEvaluator(@NotNull IBehaviorEvaluator... evaluators) {
        super(evaluators);
    }

    @Override
    public boolean evaluate(EntityIntelligent entity) {
        for (IBehaviorEvaluator evaluator : evaluators) {
            if (evaluator.evaluate(entity)) return true;
        }
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy