Search in sources :

Example 36 with MenuItemPage

use of au.com.mineauz.minigames.menu.MenuItemPage in project Minigames by AddstarMC.

the class MatchTeamCondition method displayMenu.

@Override
public boolean displayMenu(MinigamePlayer player, Menu prev) {
    Menu m = new Menu(3, "Match Team", player);
    m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, prev), m.getSize() - 9);
    List<String> teams = new ArrayList<String>();
    for (TeamColor t : TeamColor.values()) teams.add(MinigameUtils.capitalize(t.toString().replace("_", " ")));
    m.addItem(new MenuItemList("Team Color", Material.WOOL, new Callback<String>() {

        @Override
        public void setValue(String value) {
            team.setFlag(value.toUpperCase().replace(" ", "_"));
        }

        @Override
        public String getValue() {
            return MinigameUtils.capitalize(team.getFlag().replace("_", " "));
        }
    }, teams));
    addInvertMenuItem(m);
    m.displayMenu(player);
    return true;
}
Also used : Callback(au.com.mineauz.minigames.menu.Callback) MenuItemList(au.com.mineauz.minigames.menu.MenuItemList) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) ArrayList(java.util.ArrayList) TeamColor(au.com.mineauz.minigames.minigame.TeamColor) Menu(au.com.mineauz.minigames.menu.Menu)

Example 37 with MenuItemPage

use of au.com.mineauz.minigames.menu.MenuItemPage in project Minigames by AddstarMC.

the class MinigameTimerCondition method displayMenu.

@Override
public boolean displayMenu(MinigamePlayer player, Menu prev) {
    Menu m = new Menu(3, "Minigame Timer", player);
    m.addItem(new MenuItemTime("Min Time", Material.WATCH, minTime.getCallback(), 0, null));
    m.addItem(new MenuItemTime("Max Time", Material.WATCH, maxTime.getCallback(), 0, null));
    m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, prev), m.getSize() - 9);
    addInvertMenuItem(m);
    m.displayMenu(player);
    return true;
}
Also used : MenuItemTime(au.com.mineauz.minigames.menu.MenuItemTime) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) Menu(au.com.mineauz.minigames.menu.Menu)

Example 38 with MenuItemPage

use of au.com.mineauz.minigames.menu.MenuItemPage in project Minigames by AddstarMC.

the class PlayerCountCondition method displayMenu.

@Override
public boolean displayMenu(MinigamePlayer player, Menu prev) {
    Menu m = new Menu(3, "Player Count", player);
    m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, prev), m.getSize() - 9);
    m.addItem(min.getMenuItem("Min Player Count", Material.STEP, 1, null));
    m.addItem(max.getMenuItem("Max Player Count", Material.STONE, 1, null));
    addInvertMenuItem(m);
    m.displayMenu(player);
    return true;
}
Also used : MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) Menu(au.com.mineauz.minigames.menu.Menu)

Example 39 with MenuItemPage

use of au.com.mineauz.minigames.menu.MenuItemPage in project Minigames by AddstarMC.

the class MenuItemConditionAdd method onClick.

@Override
public ItemStack onClick() {
    Menu m = new Menu(6, "Conditions", getContainer().getViewer());
    m.setPreviousPage(getContainer());
    Map<String, Menu> cats = new HashMap<String, Menu>();
    List<String> cons = new ArrayList<String>(Conditions.getAllConditionNames());
    Collections.sort(cons);
    for (String con : cons) {
        if ((Conditions.getConditionByName(con).useInNodes() && nexec != null) || (Conditions.getConditionByName(con).useInRegions() && rexec != null)) {
            String catname = Conditions.getConditionByName(con).getCategory();
            if (catname == null)
                catname = "misc conditions";
            catname.toLowerCase();
            Menu cat = null;
            if (!cats.containsKey(catname)) {
                cat = new Menu(6, MinigameUtils.capitalize(catname), getContainer().getViewer());
                cats.put(catname, cat);
                m.addItem(new MenuItemPage(MinigameUtils.capitalize(catname), Material.CHEST, cat));
                cat.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, m), cat.getSize() - 9);
            } else
                cat = cats.get(catname);
            MenuItemCustom c = new MenuItemCustom(MinigameUtils.capitalize(con), Material.PAPER);
            final String fcon = con;
            c.setClick(new InteractionInterface() {

                @Override
                public Object interact(Object object) {
                    ConditionInterface condition = Conditions.getConditionByName(fcon);
                    if (rexec != null) {
                        rexec.addCondition(condition);
                        getContainer().addItem(new MenuItemCondition(MinigameUtils.capitalize(fcon), Material.PAPER, rexec, condition));
                    } else {
                        nexec.addCondition(condition);
                        getContainer().addItem(new MenuItemCondition(MinigameUtils.capitalize(fcon), Material.PAPER, nexec, condition));
                    }
                    getContainer().displayMenu(getContainer().getViewer());
                    return null;
                }
            });
            cat.addItem(c);
        }
    }
    m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, getContainer()), m.getSize() - 9);
    m.displayMenu(getContainer().getViewer());
    return null;
}
Also used : HashMap(java.util.HashMap) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) ArrayList(java.util.ArrayList) MenuItemCustom(au.com.mineauz.minigames.menu.MenuItemCustom) InteractionInterface(au.com.mineauz.minigames.menu.InteractionInterface) ConditionInterface(au.com.mineauz.minigamesregions.conditions.ConditionInterface) Menu(au.com.mineauz.minigames.menu.Menu)

Example 40 with MenuItemPage

use of au.com.mineauz.minigames.menu.MenuItemPage in project Minigames by AddstarMC.

the class MenuItemNodeExecutor method onClick.

@Override
public ItemStack onClick() {
    final MinigamePlayer fviewer = getContainer().getViewer();
    Menu m = new Menu(3, "Executor", fviewer);
    final Menu ffm = m;
    MenuItemCustom ca = new MenuItemCustom("Actions", Material.CHEST);
    ca.setClick(new InteractionInterface() {

        @Override
        public Object interact(Object object) {
            Actions.displayMenu(fviewer, ex, ffm);
            return null;
        }
    });
    m.addItem(ca);
    MenuItemCustom c2 = new MenuItemCustom("Conditions", Material.CHEST);
    c2.setClick(new InteractionInterface() {

        @Override
        public Object interact(Object object) {
            Conditions.displayMenu(fviewer, ex, ffm);
            return null;
        }
    });
    m.addItem(c2);
    m.addItem(new MenuItemNewLine());
    m.addItem(new MenuItemInteger("Trigger Count", MinigameUtils.stringToList("Number of times this;node can be;triggered"), Material.STONE, ex.getTriggerCountCallback(), 0, null));
    m.addItem(new MenuItemBoolean("Trigger Per Player", MinigameUtils.stringToList("Whether this node;is triggered per player;or just on count"), Material.ENDER_PEARL, ex.getIsTriggerPerPlayerCallback()));
    m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, getContainer()), m.getSize() - 9);
    m.displayMenu(fviewer);
    return null;
}
Also used : MinigamePlayer(au.com.mineauz.minigames.MinigamePlayer) InteractionInterface(au.com.mineauz.minigames.menu.InteractionInterface) MenuItemInteger(au.com.mineauz.minigames.menu.MenuItemInteger) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) MenuItemNewLine(au.com.mineauz.minigames.menu.MenuItemNewLine) MenuItemBoolean(au.com.mineauz.minigames.menu.MenuItemBoolean) Menu(au.com.mineauz.minigames.menu.Menu) MenuItemCustom(au.com.mineauz.minigames.menu.MenuItemCustom)

Aggregations

Menu (au.com.mineauz.minigames.menu.Menu)55 MenuItemPage (au.com.mineauz.minigames.menu.MenuItemPage)55 ArrayList (java.util.ArrayList)18 Callback (au.com.mineauz.minigames.menu.Callback)17 MenuItemList (au.com.mineauz.minigames.menu.MenuItemList)11 MenuItemString (au.com.mineauz.minigames.menu.MenuItemString)11 InteractionInterface (au.com.mineauz.minigames.menu.InteractionInterface)9 MenuItem (au.com.mineauz.minigames.menu.MenuItem)9 MenuItemCustom (au.com.mineauz.minigames.menu.MenuItemCustom)9 MenuItemNewLine (au.com.mineauz.minigames.menu.MenuItemNewLine)9 MenuItemInteger (au.com.mineauz.minigames.menu.MenuItemInteger)8 MinigamePlayer (au.com.mineauz.minigames.MinigamePlayer)7 MenuItemBoolean (au.com.mineauz.minigames.menu.MenuItemBoolean)5 TeamColor (au.com.mineauz.minigames.minigame.TeamColor)5 MenuItemTime (au.com.mineauz.minigames.menu.MenuItemTime)4 MenuItemDecimal (au.com.mineauz.minigames.menu.MenuItemDecimal)2 MinigameTool (au.com.mineauz.minigames.tool.MinigameTool)2 MenuItemCondition (au.com.mineauz.minigamesregions.menuitems.MenuItemCondition)2 MenuItemConditionAdd (au.com.mineauz.minigamesregions.menuitems.MenuItemConditionAdd)2 HashMap (java.util.HashMap)2