Search in sources :

Example 6 with MenuItemInteger

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

the class AddScoreAction method displayMenu.

@Override
public boolean displayMenu(MinigamePlayer player, Menu previous) {
    Menu m = new Menu(3, "Add Score", player);
    m.addItem(new MenuItemInteger("Add Score Amount", Material.ENDER_PEARL, new Callback<Integer>() {

        @Override
        public void setValue(Integer value) {
            amount.setFlag(value);
        }

        @Override
        public Integer getValue() {
            return amount.getFlag();
        }
    }, null, null));
    m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, previous), m.getSize() - 9);
    m.displayMenu(player);
    return true;
}
Also used : MenuItemInteger(au.com.mineauz.minigames.menu.MenuItemInteger) Callback(au.com.mineauz.minigames.menu.Callback) MenuItemInteger(au.com.mineauz.minigames.menu.MenuItemInteger) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) Menu(au.com.mineauz.minigames.menu.Menu)

Example 7 with MenuItemInteger

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

the class ApplyPotionAction method displayMenu.

@Override
public boolean displayMenu(MinigamePlayer player, Menu previous) {
    Menu m = new Menu(3, "Apply Potion", player);
    m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, previous), m.getSize() - 9);
    List<String> pots = new ArrayList<>(PotionEffectType.values().length);
    for (PotionEffectType type : PotionEffectType.values()) {
        if (type != null) {
            pots.add(MinigameUtils.capitalize(type.getName().replace("_", " ")));
        }
    }
    m.addItem(new MenuItemList("Potion Type", Material.POTION, new Callback<String>() {

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

        @Override
        public String getValue() {
            return MinigameUtils.capitalize(type.getFlag().replace("_", " "));
        }
    }, pots));
    m.addItem(new MenuItemTime("Duration", Material.WATCH, new Callback<Integer>() {

        @Override
        public void setValue(Integer value) {
            dur.setFlag(value);
        }

        @Override
        public Integer getValue() {
            return dur.getFlag();
        }
    }, 0, 86400));
    m.addItem(new MenuItemInteger("Level", Material.STONE, new Callback<Integer>() {

        @Override
        public void setValue(Integer value) {
            amp.setFlag(value);
        }

        @Override
        public Integer getValue() {
            return amp.getFlag();
        }
    }, 0, 100));
    m.displayMenu(player);
    return true;
}
Also used : MenuItemInteger(au.com.mineauz.minigames.menu.MenuItemInteger) Callback(au.com.mineauz.minigames.menu.Callback) MenuItemList(au.com.mineauz.minigames.menu.MenuItemList) MenuItemInteger(au.com.mineauz.minigames.menu.MenuItemInteger) PotionEffectType(org.bukkit.potion.PotionEffectType) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) MenuItemTime(au.com.mineauz.minigames.menu.MenuItemTime) ArrayList(java.util.ArrayList) Menu(au.com.mineauz.minigames.menu.Menu)

Example 8 with MenuItemInteger

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

the class MenuItemRegionExecutor 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)8 MenuItemInteger (au.com.mineauz.minigames.menu.MenuItemInteger)8 MenuItemPage (au.com.mineauz.minigames.menu.MenuItemPage)8 Callback (au.com.mineauz.minigames.menu.Callback)5 MenuItemBoolean (au.com.mineauz.minigames.menu.MenuItemBoolean)5 InteractionInterface (au.com.mineauz.minigames.menu.InteractionInterface)4 MenuItemCustom (au.com.mineauz.minigames.menu.MenuItemCustom)4 MenuItemList (au.com.mineauz.minigames.menu.MenuItemList)4 MinigamePlayer (au.com.mineauz.minigames.MinigamePlayer)3 MenuItemNewLine (au.com.mineauz.minigames.menu.MenuItemNewLine)3 ArrayList (java.util.ArrayList)3 MenuItemString (au.com.mineauz.minigames.menu.MenuItemString)2 MenuItemTime (au.com.mineauz.minigames.menu.MenuItemTime)2 MinigameType (au.com.mineauz.minigames.gametypes.MinigameType)1 GameMechanicBase (au.com.mineauz.minigames.mechanics.GameMechanicBase)1 MenuItem (au.com.mineauz.minigames.menu.MenuItem)1 MenuItemAddFlag (au.com.mineauz.minigames.menu.MenuItemAddFlag)1 MenuItemDisplayLoadout (au.com.mineauz.minigames.menu.MenuItemDisplayLoadout)1 MenuItemDisplayWhitelist (au.com.mineauz.minigames.menu.MenuItemDisplayWhitelist)1 MenuItemFlag (au.com.mineauz.minigames.menu.MenuItemFlag)1