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

dev.aurelium.slate.menu.LoadedMenu Maven / Gradle / Ivy

The newest version!
package dev.aurelium.slate.menu;

import dev.aurelium.slate.action.Action;
import dev.aurelium.slate.action.trigger.MenuTrigger;
import dev.aurelium.slate.component.MenuComponent;
import dev.aurelium.slate.fill.FillData;
import dev.aurelium.slate.item.MenuItem;
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public record LoadedMenu(
        String name,
        String title,
        int size,
        Map items,
        Map components,
        Map formats,
        FillData fillData,
        Map options,
        Map> actions
) {

    public void executeActions(MenuTrigger trigger, Player player, MenuInventory menuInventory) {
        List actionList = actions.getOrDefault(trigger, new ArrayList<>());
        for (Action action : actionList) {
            action.execute(player, menuInventory, menuInventory.getContents());
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy