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 PlayerInBaseCallback {
    Event<PlayerInBaseCallback> EVENT = EventFactory.createArrayBacked(PlayerInBaseCallback.class,
    (listeners) -> (player, world, power, factionTier) -> {
        for (PlayerInBaseCallback 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);
}
