Search in sources :

Example 11 with MenuItem

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

the class TeamsModule method addEditMenuOptions.

@Override
public void addEditMenuOptions(Menu menu) {
    Menu m = new Menu(6, "Teams", menu.getViewer());
    m.setPreviousPage(menu);
    List<MenuItem> items = new ArrayList<MenuItem>();
    List<String> teams = new ArrayList<String>(this.teams.size() + 1);
    for (TeamColor t : this.teams.keySet()) {
        teams.add(MinigameUtils.capitalize(t.toString().replace("_", " ")));
    }
    teams.add("None");
    items.add(new MenuItemList("Default Winning Team", Material.PAPER, getDefaultWinnerCallback(), teams));
    items.add(new MenuItemNewLine());
    for (Team t : this.teams.values()) {
        items.add(new MenuItemTeam(t.getChatColor() + t.getDisplayName(), t));
    }
    m.addItem(new MenuItemAddTeam("Add Team", getMinigame()), m.getSize() - 1);
    m.addItems(items);
    m.addItem(new MenuItemPage("Back", Material.REDSTONE_TORCH_ON, menu), m.getSize() - 9);
    MenuItemPage p = new MenuItemPage("Team Options", Material.CHEST, m);
    menu.addItem(p);
}
Also used : MenuItemTeam(au.com.mineauz.minigames.menu.MenuItemTeam) 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) TeamColor(au.com.mineauz.minigames.minigame.TeamColor) MenuItemAddTeam(au.com.mineauz.minigames.menu.MenuItemAddTeam) MenuItemList(au.com.mineauz.minigames.menu.MenuItemList) MenuItemAddTeam(au.com.mineauz.minigames.menu.MenuItemAddTeam) MenuItemTeam(au.com.mineauz.minigames.menu.MenuItemTeam) Team(au.com.mineauz.minigames.minigame.Team) Menu(au.com.mineauz.minigames.menu.Menu)

Example 12 with MenuItem

use of au.com.mineauz.minigames.menu.MenuItem 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

Menu (au.com.mineauz.minigames.menu.Menu)12 MenuItem (au.com.mineauz.minigames.menu.MenuItem)12 ArrayList (java.util.ArrayList)12 MenuItemPage (au.com.mineauz.minigames.menu.MenuItemPage)9 InteractionInterface (au.com.mineauz.minigames.menu.InteractionInterface)4 MenuItemCustom (au.com.mineauz.minigames.menu.MenuItemCustom)4 Callback (au.com.mineauz.minigames.menu.Callback)3 MenuItemDisplayLoadout (au.com.mineauz.minigames.menu.MenuItemDisplayLoadout)3 MenuItemLoadoutAdd (au.com.mineauz.minigames.menu.MenuItemLoadoutAdd)3 MenuItemNewLine (au.com.mineauz.minigames.menu.MenuItemNewLine)3 MenuItemString (au.com.mineauz.minigames.menu.MenuItemString)3 Material (org.bukkit.Material)3 MinigamePlayer (au.com.mineauz.minigames.MinigamePlayer)2 MenuItemList (au.com.mineauz.minigames.menu.MenuItemList)2 MenuItemRewardAdd (au.com.mineauz.minigames.menu.MenuItemRewardAdd)2 MenuItemRewardGroup (au.com.mineauz.minigames.menu.MenuItemRewardGroup)2 MenuItemRewardGroupAdd (au.com.mineauz.minigames.menu.MenuItemRewardGroupAdd)2 MenuItemTime (au.com.mineauz.minigames.menu.MenuItemTime)2 MinigameTool (au.com.mineauz.minigames.tool.MinigameTool)2 MinigameType (au.com.mineauz.minigames.gametypes.MinigameType)1