Search in sources :

Example 36 with ItemBuilder

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

the class DebugMenuGameOptions method openMapsMenu.

public static void openMapsMenu(Player player) {
    Menu menu = new Menu("Map Picker", 9 * 5);
    GameMap[] values = GameMap.values();
    for (int i = 0; i < values.length; i++) {
        GameMap map = values[i];
        String mapName = map.getMapName();
        menu.setItem(i % 7 + 1, 1 + i / 7, new ItemBuilder(woolSortedByColor[i + 5]).name(ChatColor.GREEN + mapName).lore(ChatColor.GRAY + "Available Gamemodes: " + ChatColor.GOLD + map.getCategories().stream().map(gameMode -> gameMode.name).collect(Collectors.joining(", "))).get(), (m, e) -> openMapsCategoryMenu(player, map));
    }
    menu.setItem(3, 4, MENU_BACK, (m, e) -> openGameMenu(player));
    menu.setItem(4, 4, MENU_CLOSE, ACTION_CLOSE_MENU);
    menu.openForPlayer(player);
}
Also used : ItemFlag(org.bukkit.inventory.ItemFlag) com.ebicep.warlords.game(com.ebicep.warlords.game) Menu(com.ebicep.warlords.menu.Menu) Enchantment(org.bukkit.enchantments.Enchantment) WinAfterTimeoutOption(com.ebicep.warlords.game.option.WinAfterTimeoutOption) Warlords(com.ebicep.warlords.Warlords) WordWrap(com.ebicep.warlords.util.bukkit.WordWrap) Player(org.bukkit.entity.Player) Collectors(java.util.stream.Collectors) ItemStack(org.bukkit.inventory.ItemStack) ArrayList(java.util.ArrayList) Objects(java.util.Objects) ItemBuilder(com.ebicep.warlords.util.bukkit.ItemBuilder) List(java.util.List) TimerDebugAble(com.ebicep.warlords.game.state.TimerDebugAble) Utils.woolSortedByColor(com.ebicep.warlords.util.warlords.Utils.woolSortedByColor) ChatColor(org.bukkit.ChatColor) Option(com.ebicep.warlords.game.option.Option) TeamMarker(com.ebicep.warlords.game.option.marker.TeamMarker) Material(org.bukkit.Material) Bukkit(org.bukkit.Bukkit) ItemBuilder(com.ebicep.warlords.util.bukkit.ItemBuilder) Menu(com.ebicep.warlords.menu.Menu)

Example 37 with ItemBuilder

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

the class DebugMenuGameOptions method openTimerMenu.

public static void openTimerMenu(Player player, Game game) {
    TimerDebugAble timerDebugAble = (TimerDebugAble) game.getState();
    Menu menu = new Menu("Timer", 9 * 4);
    menu.setItem(2, 1, new ItemBuilder(Material.WOOD_BUTTON).name(ChatColor.GREEN + "Reset").get(), (m, e) -> timerDebugAble.resetTimer());
    menu.setItem(4, 1, new ItemBuilder(Material.STONE_BUTTON).name(ChatColor.GREEN + "Skip").get(), (m, e) -> timerDebugAble.skipTimer());
    menu.setItem(6, 1, new ItemBuilder(Material.WATCH).name(ChatColor.GREEN + "Set").get(), (m, e) -> {
        for (Option option : game.getOptions()) {
            if (option instanceof WinAfterTimeoutOption) {
                int timeLeft = ((WinAfterTimeoutOption) option).getTimeRemaining();
                openTimerSetMenu(player, game, timeLeft / 60, timeLeft % 60);
                break;
            }
        }
    });
    menu.setItem(3, 3, MENU_BACK, (m, e) -> openGameEditorMenu(player, game));
    menu.setItem(4, 3, MENU_CLOSE, ACTION_CLOSE_MENU);
    menu.openForPlayer(player);
}
Also used : ItemBuilder(com.ebicep.warlords.util.bukkit.ItemBuilder) WinAfterTimeoutOption(com.ebicep.warlords.game.option.WinAfterTimeoutOption) TimerDebugAble(com.ebicep.warlords.game.state.TimerDebugAble) WinAfterTimeoutOption(com.ebicep.warlords.game.option.WinAfterTimeoutOption) Option(com.ebicep.warlords.game.option.Option) Menu(com.ebicep.warlords.menu.Menu)

Example 38 with ItemBuilder

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

the class DebugMenuGameOptions method openGameSelectMenu.

public static void openGameSelectMenu(Player player) {
    Menu menu = new Menu("Game Selector", 9 * 5);
    List<Game> games = Warlords.getGameManager().getGames().stream().map(GameManager.GameHolder::getGame).filter(Objects::nonNull).collect(Collectors.toList());
    int x = 1;
    int y = 1;
    for (Game game : games) {
        ItemBuilder itemBuilder = new ItemBuilder(Material.BOOK).name(ChatColor.GREEN + "Game - " + game.getGameId()).lore(ChatColor.DARK_GRAY + "Map - " + ChatColor.RED + game.getMap().getMapName(), ChatColor.DARK_GRAY + "GameMode - " + ChatColor.RED + game.getGameMode(), ChatColor.DARK_GRAY + "Addons - " + ChatColor.RED + game.getAddons(), ChatColor.DARK_GRAY + "Players - " + ChatColor.RED + game.playersCount());
        if (Warlords.getPlayer(player) != null && Warlords.getPlayer(player).getGame() == game) {
            itemBuilder.enchant(Enchantment.OXYGEN, 1);
            itemBuilder.flags(ItemFlag.HIDE_ENCHANTS);
        }
        menu.setItem(x, y, itemBuilder.get(), (m, e) -> openGameEditorMenu(player, game));
        x++;
        if (x == 7) {
            x = 1;
            y++;
        }
    }
    menu.setItem(3, 4, MENU_BACK, (m, e) -> openGameMenu(player));
    menu.setItem(4, 4, MENU_CLOSE, ACTION_CLOSE_MENU);
    menu.openForPlayer(player);
}
Also used : ItemBuilder(com.ebicep.warlords.util.bukkit.ItemBuilder) Menu(com.ebicep.warlords.menu.Menu)

Example 39 with ItemBuilder

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

the class DebugMenuPlayerOptions method openSkillBoostMenu.

public static void openSkillBoostMenu(Player player, WarlordsPlayer target, Classes selectedClass) {
    Menu menu = new Menu("Skill Boost: " + target.getName(), 9 * 4);
    List<ClassesSkillBoosts> values = selectedClass.skillBoosts;
    for (int i = 0; i < values.size(); i++) {
        ClassesSkillBoosts skillBoost = values.get(i);
        menu.setItem(i + 2, 1, new ItemBuilder(selectedClass.specType.itemStack).name(ChatColor.RED + skillBoost.name + " (" + selectedClass.name + ")").lore(skillBoost.description, "", ChatColor.YELLOW + "Click to select!").get(), (m, e) -> {
            setSelectedBoost(Bukkit.getPlayer(target.getUuid()), skillBoost);
            target.setSpec(selectedClass.create.get(), skillBoost);
            target.getGameState().updatePlayerName(target);
            player.sendMessage(ChatColor.RED + "DEV: " + target.getColoredName() + "'s §aspec was changed to " + selectedClass.name);
            openSpecMenu(player, target);
        });
    }
    menu.setItem(3, 3, MENU_BACK, (m, e) -> openSpecMenu(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)

Example 40 with ItemBuilder

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

the class DebugMenuPlayerOptions method openFlagMultiplierMenu.

public static void openFlagMultiplierMenu(Player player, WarlordsPlayer target) {
    Menu menu = new Menu("Flag Multiplier: " + target.getName(), 9 * 4);
    int[] multipliers = { 5, 10, 30, 60, 100, 150, 300 };
    for (int i = 0; i < 7; i++) {
        int finalI = i;
        menu.setItem(i + 1, 1, new ItemBuilder(woolSortedByColor[i + 5]).name(ChatColor.GREEN.toString() + multipliers[i]).get(), (m, e) -> {
            int amount = e.isLeftClick() ? multipliers[finalI] : -multipliers[finalI];
            if (target.getCarriedFlag() != null) {
                PlayerFlagLocation redFlag = ((PlayerFlagLocation) target.getCarriedFlag().getFlag());
                if (redFlag.getPickUpTicks() + (60 * amount) < 0) {
                    amount = -redFlag.getPickUpTicks() / 60;
                }
                redFlag.addPickUpTicks(60 * amount);
                player.sendMessage(ChatColor.RED + "DEV: §aThe blue flag carrier gained " + amount + "%");
            }
        });
    }
    menu.setItem(3, 3, MENU_BACK, (m, e) -> openFlagOptionMenu(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) PlayerFlagLocation(com.ebicep.warlords.game.flags.PlayerFlagLocation)

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