Search in sources :

Example 11 with MenuItemString

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

the class SpawnEntityAction method livingEntitySettings.

private void livingEntitySettings(Menu eSet) {
    settings.put("displayname", "");
    settings.put("displaynamevisible", "false");
    eSet.addItem(new MenuItemString("Display Name", Material.NAME_TAG, new Callback<String>() {

        @Override
        public void setValue(String value) {
            settings.put("displayname", value);
        }

        @Override
        public String getValue() {
            return settings.get("displayname");
        }
    }));
    eSet.addItem(new MenuItemBoolean("Display Name Visible", Material.ENDER_PEARL, new Callback<Boolean>() {

        @Override
        public void setValue(Boolean value) {
            settings.put("displaynamevisible", value.toString());
        }

        @Override
        public Boolean getValue() {
            return Boolean.valueOf(settings.get("displaynamevisible"));
        }
    }));
}
Also used : Callback(au.com.mineauz.minigames.menu.Callback) MenuItemBoolean(au.com.mineauz.minigames.menu.MenuItemBoolean) MenuItemString(au.com.mineauz.minigames.menu.MenuItemString) MenuItemBoolean(au.com.mineauz.minigames.menu.MenuItemBoolean) MenuItemString(au.com.mineauz.minigames.menu.MenuItemString)

Example 12 with MenuItemString

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

the class GiveItemAction method displayMenu.

@Override
public boolean displayMenu(final MinigamePlayer player, Menu previous) {
    Menu m = new Menu(3, "Give Item", player);
    m.addItem(new MenuItemBack(previous), m.getSize() - 9);
    MenuItemString n = (MenuItemString) name.getMenuItem("Name", Material.NAME_TAG);
    n.setAllowNull(true);
    m.addItem(n);
    MenuItemString l = (MenuItemString) lore.getMenuItem("Lore", Material.PAPER, MinigameUtils.stringToList("Separate with semi-colons;for new lines"));
    l.setAllowNull(true);
    m.addItem(l);
    m.addItem(new MenuItemString("Type", Material.STONE, new Callback<String>() {

        @Override
        public void setValue(String value) {
            if (Material.getMaterial(value.toUpperCase()) != null) {
                type.setFlag(value.toUpperCase());
            } else
                player.sendMessage("Invalid item type!", "error");
        }

        @Override
        public String getValue() {
            return type.getFlag();
        }
    }));
    m.addItem(count.getMenuItem("Count", Material.STEP, 1, 64));
    m.addItem(damage.getMenuItem("Damage", Material.COBBLESTONE, 0, null));
    m.displayMenu(player);
    return true;
}
Also used : Callback(au.com.mineauz.minigames.menu.Callback) MenuItemBack(au.com.mineauz.minigames.menu.MenuItemBack) Menu(au.com.mineauz.minigames.menu.Menu) MenuItemString(au.com.mineauz.minigames.menu.MenuItemString) MenuItemString(au.com.mineauz.minigames.menu.MenuItemString)

Example 13 with MenuItemString

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

the class RegionToolMode method onSetMode.

@Override
public void onSetMode(final MinigamePlayer player, MinigameTool tool) {
    tool.addSetting("Region", "None");
    final Menu m = new Menu(2, "Region Selection", player);
    if (player.isInMenu()) {
        m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, player.getMenu()), m.getSize() - 9);
    }
    final MinigameTool ftool = tool;
    m.addItem(new MenuItemString("Region Name", Material.PAPER, new Callback<String>() {

        @Override
        public void setValue(String value) {
            ftool.changeSetting("Region", value);
        }

        @Override
        public String getValue() {
            return ftool.getSetting("Region");
        }
    }));
    if (tool.getMinigame() != null) {
        // Node selection menu
        RegionModule module = RegionModule.getMinigameModule(tool.getMinigame());
        Menu regionMenu = new Menu(6, "Regions", player);
        List<MenuItem> items = new ArrayList<MenuItem>();
        for (final Region region : module.getRegions()) {
            MenuItemCustom item = new MenuItemCustom(region.getName(), Material.CHEST);
            // Set the node and go back to the main menu
            item.setClick(new InteractionInterface() {

                @Override
                public Object interact(Object object) {
                    ftool.changeSetting("Region", region.getName());
                    m.displayMenu(player);
                    return object;
                }
            });
            items.add(item);
        }
        regionMenu.addItems(items);
        regionMenu.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, m), regionMenu.getSize() - 9);
        m.addItem(new MenuItemPage("Edit Region", Material.CHEST, regionMenu));
    }
    m.displayMenu(player);
}
Also used : MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) MinigameTool(au.com.mineauz.minigames.tool.MinigameTool) ArrayList(java.util.ArrayList) MenuItem(au.com.mineauz.minigames.menu.MenuItem) MenuItemString(au.com.mineauz.minigames.menu.MenuItemString) MenuItemCustom(au.com.mineauz.minigames.menu.MenuItemCustom) MenuItemString(au.com.mineauz.minigames.menu.MenuItemString) Callback(au.com.mineauz.minigames.menu.Callback) InteractionInterface(au.com.mineauz.minigames.menu.InteractionInterface) Menu(au.com.mineauz.minigames.menu.Menu)

Aggregations

MenuItemString (au.com.mineauz.minigames.menu.MenuItemString)13 Menu (au.com.mineauz.minigames.menu.Menu)12 Callback (au.com.mineauz.minigames.menu.Callback)11 MenuItemPage (au.com.mineauz.minigames.menu.MenuItemPage)10 MinigamePlayer (au.com.mineauz.minigames.MinigamePlayer)4 InteractionInterface (au.com.mineauz.minigames.menu.InteractionInterface)4 MenuItemCustom (au.com.mineauz.minigames.menu.MenuItemCustom)4 MenuItemNewLine (au.com.mineauz.minigames.menu.MenuItemNewLine)4 MenuItem (au.com.mineauz.minigames.menu.MenuItem)3 MenuItemBoolean (au.com.mineauz.minigames.menu.MenuItemBoolean)3 ArrayList (java.util.ArrayList)3 MenuItemBack (au.com.mineauz.minigames.menu.MenuItemBack)2 MenuItemInteger (au.com.mineauz.minigames.menu.MenuItemInteger)2 MenuItemList (au.com.mineauz.minigames.menu.MenuItemList)2 MinigameTool (au.com.mineauz.minigames.tool.MinigameTool)2 MinigameType (au.com.mineauz.minigames.gametypes.MinigameType)1 GameMechanicBase (au.com.mineauz.minigames.mechanics.GameMechanicBase)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