Search in sources :

Example 1 with MenuItemNode

use of au.com.mineauz.minigamesregions.menuitems.MenuItemNode in project Minigames by AddstarMC.

the class RegionModule method displayMenu.

public void displayMenu(MinigamePlayer viewer, Menu previous) {
    Menu rm = new Menu(6, "Regions and Nodes", viewer);
    List<MenuItem> items = new ArrayList<MenuItem>(regions.size());
    for (String name : regions.keySet()) {
        MenuItemRegion mir = new MenuItemRegion(name, Material.CHEST, regions.get(name), this);
        items.add(mir);
    }
    items.add(new MenuItemNewLine());
    for (String name : nodes.keySet()) {
        MenuItemNode min = new MenuItemNode(name, Material.CHEST, nodes.get(name), this);
        items.add(min);
    }
    rm.addItems(items);
    if (previous != null)
        rm.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, previous), rm.getSize() - 9);
    rm.displayMenu(viewer);
}
Also used : MenuItemNode(au.com.mineauz.minigamesregions.menuitems.MenuItemNode) MenuItemRegion(au.com.mineauz.minigamesregions.menuitems.MenuItemRegion) MenuItemPage(au.com.mineauz.minigames.menu.MenuItemPage) ArrayList(java.util.ArrayList) MenuItemNewLine(au.com.mineauz.minigames.menu.MenuItemNewLine) MenuItem(au.com.mineauz.minigames.menu.MenuItem) Menu(au.com.mineauz.minigames.menu.Menu)

Example 2 with MenuItemNode

use of au.com.mineauz.minigamesregions.menuitems.MenuItemNode in project Minigames by AddstarMC.

the class RegionNodeEditToolMode method openChooseMenu.

private void openChooseMenu(MinigamePlayer player, RegionModule module, Set<Object> objects) {
    Menu menu = new Menu(3, "Choose Region or Node", player);
    StringBuilder options = new StringBuilder();
    for (Object object : objects) {
        if (options.length() != 0) {
            options.append(", ");
        }
        if (object instanceof Region) {
            options.append(((Region) object).getName());
            MenuItemRegion item = new MenuItemRegion(((Region) object).getName(), Material.CHEST, (Region) object, module);
            menu.addItem(item);
        } else if (object instanceof Node) {
            options.append(((Node) object).getName());
            MenuItemNode item = new MenuItemNode(((Node) object).getName(), Material.STONE_BUTTON, (Node) object, module);
            menu.addItem(item);
        }
    }
    menu.addItem(new MenuItemSaveMinigame("Save", Material.REDSTONE_TORCH_ON, module.getMinigame()), menu.getSize() - 9);
    menu.displayMenu(player);
    player.sendMessage("Multiple regions/nodes selected: " + options.toString(), null);
}
Also used : MenuItemNode(au.com.mineauz.minigamesregions.menuitems.MenuItemNode) MenuItemRegion(au.com.mineauz.minigamesregions.menuitems.MenuItemRegion) MenuItemNode(au.com.mineauz.minigamesregions.menuitems.MenuItemNode) MenuItemRegion(au.com.mineauz.minigamesregions.menuitems.MenuItemRegion) Menu(au.com.mineauz.minigames.menu.Menu) MenuItemSaveMinigame(au.com.mineauz.minigames.menu.MenuItemSaveMinigame)

Aggregations

Menu (au.com.mineauz.minigames.menu.Menu)2 MenuItemNode (au.com.mineauz.minigamesregions.menuitems.MenuItemNode)2 MenuItemRegion (au.com.mineauz.minigamesregions.menuitems.MenuItemRegion)2 MenuItem (au.com.mineauz.minigames.menu.MenuItem)1 MenuItemNewLine (au.com.mineauz.minigames.menu.MenuItemNewLine)1 MenuItemPage (au.com.mineauz.minigames.menu.MenuItemPage)1 MenuItemSaveMinigame (au.com.mineauz.minigames.menu.MenuItemSaveMinigame)1 ArrayList (java.util.ArrayList)1