package jesse.keeblarcraft.FactionMgr.Callbacks;

import jesse.keeblarcraft.FactionMgr.FactionTier.FactionTierEnum;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.world.World;

public interface PlayerEnteredBaseCallback {
    Event<PlayerEnteredBaseCallback> EVENT = EventFactory.createArrayBacked(PlayerEnteredBaseCallback.class,
    (listeners) -> (player, world, power, factionTier) -> {
        for (PlayerEnteredBaseCallback listener : listeners) {
            ActionResult result = listener.interact(player, world, power, factionTier);

            if (result != ActionResult.PASS) {
                return result;
            }
        }

        return ActionResult.PASS;
    });

    ActionResult interact(PlayerEntity player, World world, Integer factionPower, FactionTierEnum factionTier);
}
