Search in sources :

Example 11 with ItemBuilder

use of com.ebicep.warlords.util.bukkit.ItemBuilder in project Warlords by ebicep.

the class DebugMenuGameOptions method openMapsCategoryMenu.

public static void openMapsCategoryMenu(Player player, GameMap selectedGameMap) {
    int menuHeight = (4 + selectedGameMap.getCategories().size() / 7);
    Menu menu = new Menu(selectedGameMap.getMapName(), 9 * menuHeight);
    for (int i = 0; i < selectedGameMap.getCategories().size(); i++) {
        GameMode gameMode = selectedGameMap.getCategories().get(i);
        menu.setItem(i % 7 + 1, 1 + i / 7, new ItemBuilder(woolSortedByColor[i + 5]).name(ChatColor.GREEN + gameMode.name).get(), (m, e) -> {
            List<GameAddon> addons = new ArrayList<>();
            addons.add(GameAddon.PRIVATE_GAME);
            addons.add(GameAddon.CUSTOM_GAME);
            openMapsAddonsMenu(player, selectedGameMap, gameMode, addons);
        });
    }
    menu.setItem(3, menuHeight - 1, MENU_BACK, (m, e) -> openMapsMenu(player));
    menu.setItem(4, menuHeight - 1, MENU_CLOSE, ACTION_CLOSE_MENU);
    menu.openForPlayer(player);
}
Also used : ItemBuilder(com.ebicep.warlords.util.bukkit.ItemBuilder) ArrayList(java.util.ArrayList) Menu(com.ebicep.warlords.menu.Menu)

Example 12 with ItemBuilder

use of com.ebicep.warlords.util.bukkit.ItemBuilder in project Warlords by ebicep.

the class DebugMenuGameOptions method openGameMenu.

public static void openGameMenu(Player player) {
    Menu menu = new Menu("Game Options", 9 * 4);
    ItemStack[] itemStack = { new ItemBuilder(Material.DARK_OAK_DOOR_ITEM).name(ChatColor.GREEN + "Start").get(), new ItemBuilder(Material.BOOK).name(ChatColor.GREEN + "Games").get() // new ItemBuilder(Material.ICE)
    // .name(ChatColor.GREEN + "Freeze Game")
    // .get(),
    };
    for (int i = 0; i < itemStack.length; i++) {
        int index = i + 1;
        menu.setItem(index, 1, itemStack[i], (m, e) -> {
            switch(index) {
                case 1:
                    openMapsMenu(player);
                    break;
                case 2:
                    openGameSelectMenu(player);
                    break;
            }
        });
    }
    menu.setItem(3, 3, MENU_BACK, (m, e) -> DebugMenu.openDebugMenu(player));
    menu.setItem(4, 3, MENU_CLOSE, ACTION_CLOSE_MENU);
    menu.openForPlayer(player);
}
Also used : ItemBuilder(com.ebicep.warlords.util.bukkit.ItemBuilder) Menu(com.ebicep.warlords.menu.Menu) ItemStack(org.bukkit.inventory.ItemStack)

Example 13 with ItemBuilder

use of com.ebicep.warlords.util.bukkit.ItemBuilder in project Warlords by ebicep.

the class DebugMenuGameOptions method openGameEditorMenu.

public static void openGameEditorMenu(Player player, Game game) {
    Menu menu = new Menu("Game Editor", 9 * 4);
    menu.setItem(1, 1, new ItemBuilder(Material.DIODE).name(ChatColor.GREEN + "Timer").get(), (m, e) -> openTimerMenu(player, game));
    menu.setItem(2, 1, new ItemBuilder(Material.SIGN).name(ChatColor.GREEN + "Edit Team Scores").get(), (m, e) -> openTeamScoreEditorMenu(player, game));
    menu.setItem(3, 1, new ItemBuilder(Material.ICE).name(ChatColor.GREEN + "Freeze Game").get(), (m, e) -> {
        if (game.isFrozen()) {
            game.removeFrozenCause("Debug");
        } else {
            game.addFrozenCause("Debug");
        }
    });
    menu.setItem(3, 3, MENU_BACK, (m, e) -> openGameSelectMenu(player));
    menu.setItem(4, 3, MENU_CLOSE, ACTION_CLOSE_MENU);
    menu.openForPlayer(player);
}
Also used : ItemBuilder(com.ebicep.warlords.util.bukkit.ItemBuilder) Menu(com.ebicep.warlords.menu.Menu)

Example 14 with ItemBuilder

use of com.ebicep.warlords.util.bukkit.ItemBuilder in project Warlords by ebicep.

the class DebugMenuGameOptions method openScoreEditorMenu.

public static void openScoreEditorMenu(Player player, Game game, Team team, int points) {
    Menu menu = new Menu("Score Editor", 9 * 4);
    menu.setItem(1, 1, new ItemBuilder(team.item).name(team.teamColor + team.name + " - " + points).lore(ChatColor.YELLOW + "Left-Click to ADD" + "\n" + "Right-Click to SUBTRACT").get(), (m, e) -> {
    });
    menu.setItem(2, 1, new ItemBuilder(Material.LEVER).name(ChatColor.GREEN + "1").get(), (m, e) -> openScoreEditorMenu(player, game, team, points + (e.isLeftClick() ? 1 : -1)));
    menu.setItem(3, 1, new ItemBuilder(Material.LEVER).name(ChatColor.GREEN + "5").get(), (m, e) -> openScoreEditorMenu(player, game, team, points + (e.isLeftClick() ? 5 : -5)));
    menu.setItem(4, 1, new ItemBuilder(Material.LEVER).name(ChatColor.GREEN + "10").get(), (m, e) -> openScoreEditorMenu(player, game, team, points + (e.isLeftClick() ? 10 : -10)));
    menu.setItem(5, 1, new ItemBuilder(Material.LEVER).name(ChatColor.GREEN + "25").get(), (m, e) -> openScoreEditorMenu(player, game, team, points + (e.isLeftClick() ? 25 : -25)));
    menu.setItem(6, 1, new ItemBuilder(Material.LEVER).name(ChatColor.GREEN + "250").get(), (m, e) -> openScoreEditorMenu(player, game, team, points + (e.isLeftClick() ? 250 : -250)));
    menu.setItem(3, 3, MENU_BACK, (m, e) -> openTeamScoreEditorMenu(player, game));
    menu.setItem(4, 3, MENU_CLOSE, ACTION_CLOSE_MENU);
    menu.setItem(5, 3, new ItemBuilder(Material.WOOL, 1, (byte) 5).name(ChatColor.GREEN + "Set Score - " + points).get(), (m, e) -> game.setPoints(team, points));
    menu.openForPlayer(player);
}
Also used : ItemBuilder(com.ebicep.warlords.util.bukkit.ItemBuilder) Menu(com.ebicep.warlords.menu.Menu)

Example 15 with ItemBuilder

use of com.ebicep.warlords.util.bukkit.ItemBuilder in project Warlords by ebicep.

the class DebugMenuPlayerOptions method openAmountMenu.

public static void openAmountMenu(Player player, WarlordsPlayer target, String commandType) {
    String targetName = target != null ? target.getName() : "";
    String commandName = commandType.equals("heal") ? "Give Health" : "Take Damage";
    Menu menu = new Menu(commandName + ": " + (target != null ? targetName : player.getName()), 9 * 4);
    for (int i = 1; i <= 5; i++) {
        int amount = i * 1000;
        menu.setItem(i + 1, 1, new ItemBuilder(woolSortedByColor[i - 1]).name((commandType.equals("takedamage") ? ChatColor.RED.toString() : ChatColor.GREEN.toString()) + amount).get(), (m, e) -> Bukkit.getServer().dispatchCommand(player, "wl " + commandType + " " + amount + " " + targetName));
    }
    menu.setItem(3, 3, MENU_BACK, (m, e) -> openPlayerMenu(player, target));
    menu.setItem(4, 3, MENU_CLOSE, ACTION_CLOSE_MENU);
    menu.openForPlayer(player);
}
Also used : ItemBuilder(com.ebicep.warlords.util.bukkit.ItemBuilder) Menu(com.ebicep.warlords.menu.Menu)

Aggregations

ItemBuilder (com.ebicep.warlords.util.bukkit.ItemBuilder)49 Menu (com.ebicep.warlords.menu.Menu)31 ItemStack (org.bukkit.inventory.ItemStack)22 Warlords (com.ebicep.warlords.Warlords)12 Player (org.bukkit.entity.Player)12 Classes (com.ebicep.warlords.player.Classes)11 DatabasePlayer (com.ebicep.warlords.database.repositories.player.pojos.general.DatabasePlayer)10 Collectors (java.util.stream.Collectors)10 DatabaseManager (com.ebicep.warlords.database.DatabaseManager)8 Team (com.ebicep.warlords.game.Team)8 ChatColor (org.bukkit.ChatColor)8 AbstractPlayerClass (com.ebicep.warlords.classes.AbstractPlayerClass)7 List (java.util.List)7 Material (org.bukkit.Material)7 Enchantment (org.bukkit.enchantments.Enchantment)7 ItemFlag (org.bukkit.inventory.ItemFlag)7 ArrayList (java.util.ArrayList)6 Arrays (java.util.Arrays)6 UUID (java.util.UUID)6 Game (com.ebicep.warlords.game.Game)5