Search in sources :

Example 16 with ItemBuilder

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

the class DebugMenuPlayerOptions method openSpecMenu.

public static void openSpecMenu(Player player, WarlordsPlayer target) {
    Menu menu = new Menu("Spec Menu: " + target.getName(), 9 * 6);
    ClassesGroup[] values = ClassesGroup.values();
    for (int i = 0; i < values.length; i++) {
        ClassesGroup group = values[i];
        menu.setItem(2, i, new ItemBuilder(group.item).name(ChatColor.GREEN + group.name).get(), (m, e) -> {
        });
        List<Classes> classes = group.subclasses;
        for (int j = 0; j < classes.size(); j++) {
            int finalJ = j;
            ItemBuilder spec = new ItemBuilder(classes.get(j).specType.itemStack).name(ChatColor.GREEN + classes.get(j).name);
            if (target.getSpecClass() == classes.get(j)) {
                spec.enchant(Enchantment.OXYGEN, 1);
                spec.flags(ItemFlag.HIDE_ENCHANTS);
            }
            menu.setItem(4 + j, i, spec.get(), (m, e) -> openSkillBoostMenu(player, target, classes.get(finalJ)));
        }
    }
    menu.setItem(3, 5, MENU_BACK, (m, e) -> openPlayerMenu(player, target));
    menu.setItem(4, 5, MENU_CLOSE, ACTION_CLOSE_MENU);
    menu.openForPlayer(player);
}
Also used : ItemBuilder(com.ebicep.warlords.util.bukkit.ItemBuilder) Menu(com.ebicep.warlords.menu.Menu)

Example 17 with ItemBuilder

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

the class DebugMenuPlayerOptions method openCooldownTimerMenu.

public static void openCooldownTimerMenu(Player player, WarlordsPlayer target, AbstractCooldown abstractCooldown) {
    Menu menu = new Menu(abstractCooldown.getName() + "Duration: " + target.getName(), 9 * 4);
    int[] durations = { 5, 15, 30, 60, 120, 300, 600 };
    for (int i = 0; i < durations.length; i++) {
        int finalI = i;
        menu.setItem(i + 1, 1, new ItemBuilder(woolSortedByColor[i + 5]).name(ChatColor.GREEN.toString() + durations[i] + "s").get(), (m, e) -> {
            if (target.getCooldownManager().getCooldowns().contains(abstractCooldown)) {
                // abstractCooldown.subtractTime(-durations[finalI]);
                player.sendMessage(ChatColor.RED + "DEV: " + target.getColoredName() + "'s §a" + abstractCooldown.getName() + "'s duration was increased by " + durations[finalI] + " seconds");
            } else {
                openCooldownsMenu(player, target);
                player.sendMessage(ChatColor.RED + "DEV: §aThat cooldown no longer exists");
            }
        });
    }
    menu.setItem(3, 3, MENU_BACK, (m, e) -> openCooldownMenu(player, target, abstractCooldown));
    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 18 with ItemBuilder

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

the class DebugMenuPlayerOptions method openTeamMenu.

public static void openTeamMenu(Player player) {
    WarlordsPlayer warlordsPlayer = Warlords.getPlayer(player);
    if (warlordsPlayer == null)
        return;
    Menu menu = new Menu("Team Options", 9 * 6);
    // divider
    for (int i = 0; i < 5; i++) {
        menu.setItem(4, i, new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (byte) 7).name(" ").get(), (m, e) -> {
        });
    }
    // team info = color - other shit
    List<WarlordsPlayer> bluePlayers = new ArrayList<>();
    List<WarlordsPlayer> redPlayers = new ArrayList<>();
    PlayerFilter.playingGame(warlordsPlayer.getGame()).forEach((wp) -> {
        if (wp.getTeam() == Team.BLUE) {
            bluePlayers.add(wp);
        } else if (wp.getTeam() == Team.RED) {
            redPlayers.add(wp);
        }
    });
    ItemStack blueInfo = new ItemBuilder(Material.WOOL, 1, (byte) 11).name(ChatColor.BLUE + "BLU").lore(getTeamStatLore(bluePlayers)).get();
    ItemStack redInfo = new ItemBuilder(Material.WOOL, 1, (byte) 14).name(ChatColor.RED + "RED").lore(getTeamStatLore(redPlayers)).get();
    ItemStack killTeam = new ItemBuilder(Material.DIAMOND_SWORD).name(ChatColor.RED + "Kill All").lore(ChatColor.GRAY + "Kills all the players on the team").flags(ItemFlag.HIDE_ATTRIBUTES).get();
    menu.setItem(0, 0, blueInfo, (m, e) -> {
    });
    menu.setItem(3, 0, killTeam, (m, e) -> {
        bluePlayers.forEach(wp -> wp.addDamageInstance(wp, "", 69000, 69000, -1, 100, false));
    });
    menu.setItem(5, 0, redInfo, (m, e) -> {
    });
    menu.setItem(8, 0, killTeam, (m, e) -> {
        redPlayers.forEach(wp -> wp.addDamageInstance(wp, "", 69000, 69000, -1, 100, false));
    });
    // players
    addPlayersToMenu(menu, player, bluePlayers, true);
    addPlayersToMenu(menu, player, redPlayers, false);
    menu.setItem(3, 5, MENU_BACK, (m, e) -> DebugMenu.openDebugMenu(player));
    menu.setItem(4, 5, 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) ItemStack(org.bukkit.inventory.ItemStack)

Example 19 with ItemBuilder

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

the class DebugMenuPlayerOptions method openPlayerMenu.

public static void openPlayerMenu(Player player, WarlordsPlayer target) {
    if (target == null)
        return;
    String targetName = target.getName();
    Menu menu = new Menu("Player Options: " + targetName, 9 * 5);
    ItemStack[] firstRow = { new ItemBuilder(Material.EXP_BOTTLE).name(ChatColor.GREEN + "Energy").get(), new ItemBuilder(Material.INK_SACK, 1, (byte) 8).name(ChatColor.GREEN + "Cooldown").get(), new ItemBuilder(Material.DIAMOND_CHESTPLATE).name(ChatColor.GREEN + "Damage").get(), new ItemBuilder(Material.RABBIT_FOOT).name(ChatColor.GREEN + "Crits").get(), new ItemBuilder(Material.AIR).get(), new ItemBuilder(new Potion(PotionType.INSTANT_DAMAGE), 1, true).name(ChatColor.GREEN + "Kill").flags(ItemFlag.HIDE_POTION_EFFECTS).get(), new ItemBuilder(Material.WOOL, 1, (short) (Warlords.getPlayerSettings(player.getUniqueId()).getWantedTeam() == Team.BLUE ? 14 : 11)).name(ChatColor.GREEN + "Swap to the " + (Warlords.getPlayerSettings(player.getUniqueId()).getWantedTeam() == Team.BLUE ? Team.RED.coloredPrefix() : Team.BLUE.coloredPrefix()) + ChatColor.GREEN + " team").get() };
    ItemStack[] secondRow = { new ItemBuilder(Material.SUGAR).name(ChatColor.GREEN + "Modify Speed").get(), new ItemBuilder(new Potion(PotionType.INSTANT_HEAL), 1, true).name(ChatColor.GREEN + "Add Health").flags(ItemFlag.HIDE_POTION_EFFECTS).get(), new ItemBuilder(Material.DIAMOND_SWORD).name(ChatColor.GREEN + "Take Damage").flags(ItemFlag.HIDE_ATTRIBUTES).get(), new ItemBuilder(Material.BREWING_STAND_ITEM).name(ChatColor.GREEN + "Cooldowns").get(), new ItemBuilder(Material.EYE_OF_ENDER).name(ChatColor.GREEN + "Teleport To").get(), new ItemBuilder(Material.BANNER).name(ChatColor.GREEN + "Flag Options").get(), new ItemBuilder(Material.NETHER_STAR).name(ChatColor.GREEN + "Change Spec").get() };
    for (int i = 0; i < firstRow.length; i++) {
        int index = i + 1;
        menu.setItem(index, 1, firstRow[i], (m, e) -> {
            switch(index) {
                case 1:
                    Bukkit.getServer().dispatchCommand(player, "wl energy " + (target.isInfiniteEnergy() ? "enable" : "disable") + " " + targetName);
                    break;
                case 2:
                    Bukkit.getServer().dispatchCommand(player, "wl cooldown " + (target.isDisableCooldowns() ? "enable" : "disable") + " " + targetName);
                    break;
                case 3:
                    Bukkit.getServer().dispatchCommand(player, "wl damage " + (target.isTakeDamage() ? "disable" : "enable") + " " + targetName);
                    break;
                case 4:
                    Bukkit.getServer().dispatchCommand(player, "wl crits " + (target.isCanCrit() ? "disable" : "enable") + " " + targetName);
                    break;
                case 6:
                    Bukkit.getServer().dispatchCommand(player, "kill " + targetName);
                    break;
                case 7:
                    Game game = target.getGame();
                    Team currentTeam = target.getTeam();
                    Team otherTeam = target.getTeam().enemy();
                    game.setPlayerTeam(player, otherTeam);
                    target.setTeam(otherTeam);
                    target.getGameState().updatePlayerName(target);
                    Warlords.getPlayerSettings(target.getUuid()).setWantedTeam(otherTeam);
                    LobbyLocationMarker randomLobbyLocation = LobbyLocationMarker.getRandomLobbyLocation(game, otherTeam);
                    if (randomLobbyLocation != null) {
                        Location teleportDestination = MapSymmetryMarker.getSymmetry(game).getOppositeLocation(game, currentTeam, otherTeam, target.getLocation(), randomLobbyLocation.getLocation());
                        target.teleport(teleportDestination);
                    }
                    ArmorManager.resetArmor(Bukkit.getPlayer(target.getUuid()), Warlords.getPlayerSettings(target.getUuid()).getSelectedClass(), otherTeam);
                    player.sendMessage(ChatColor.RED + "DEV: " + currentTeam.teamColor() + target.getName() + "§a was swapped to the " + otherTeam.coloredPrefix() + " §ateam");
                    openPlayerMenu(player, target);
                    break;
            }
        });
    }
    for (int i = 0; i < secondRow.length; i++) {
        int index = i + 1;
        menu.setItem(index, 2, secondRow[i], (m, e) -> {
            switch(index) {
                case 1:
                    // TODO
                    break;
                case 2:
                    openAmountMenu(player, target, "heal");
                    break;
                case 3:
                    openAmountMenu(player, target, "takedamage");
                    break;
                case 4:
                    openCooldownsMenu(player, target);
                    break;
                case 5:
                    openTeleportLocations(player, target);
                    break;
                case 6:
                    openFlagOptionMenu(player, target);
                    break;
                case 7:
                    openSpecMenu(player, target);
                    break;
            }
        });
    }
    menu.setItem(3, 4, MENU_BACK, (m, e) -> {
        if (player.getUniqueId() == target.getUuid()) {
            DebugMenu.openDebugMenu(player);
        } else {
            openTeamMenu(player);
        }
    });
    menu.setItem(4, 4, MENU_CLOSE, ACTION_CLOSE_MENU);
    menu.openForPlayer(player);
}
Also used : LobbyLocationMarker(com.ebicep.warlords.game.option.marker.LobbyLocationMarker) ItemBuilder(com.ebicep.warlords.util.bukkit.ItemBuilder) Game(com.ebicep.warlords.game.Game) Potion(org.bukkit.potion.Potion) Team(com.ebicep.warlords.game.Team) Menu(com.ebicep.warlords.menu.Menu) ItemStack(org.bukkit.inventory.ItemStack) Location(org.bukkit.Location) PlayerFlagLocation(com.ebicep.warlords.game.flags.PlayerFlagLocation) GroundFlagLocation(com.ebicep.warlords.game.flags.GroundFlagLocation) SpawnFlagLocation(com.ebicep.warlords.game.flags.SpawnFlagLocation)

Example 20 with ItemBuilder

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

the class DebugMenuPlayerOptions method openCooldownManagerMenu.

public static void openCooldownManagerMenu(Player player, WarlordsPlayer target) {
    // int menuY = Math.min(4 + target.getCooldownManager().getCooldowns().size() / 7, 6); Menu shift annoying
    Menu menu = new Menu("Cooldown Manager: " + target.getName(), 9 * 6);
    // general info
    menu.setItem(4, 0, new ItemBuilder(Warlords.getHead(player)).name(ChatColor.GREEN + "Cooldown Stats").lore(ChatColor.GREEN + "Total Cooldowns: " + target.getCooldownManager().getTotalCooldowns(), ChatColor.GREEN + "Active Cooldowns: " + target.getCooldownManager().getCooldowns().size()).get(), (m, e) -> {
    });
    // cooldowns
    int yLevel = 0;
    // List<AbstractCooldown> abstractCooldowns = new ArrayList<>(target.getCooldownManager().getCooldowns());
    // abstractCooldowns.sort(Comparator.comparing(AbstractCooldown::getTimeLeft));
    // for (int i = 0; i < abstractCooldowns.size(); i++) {
    // if (i % 7 == 0) {
    // yLevel++;
    // if (yLevel > 4) break;
    // }
    // AbstractCooldown abstractCooldown = abstractCooldowns.get(i);
    // menu.setItem((i % 7) + 1, yLevel,
    // new ItemBuilder(woolSortedByColor[i % woolSortedByColor.length])
    // .name(ChatColor.GOLD + abstractCooldown.getName())
    // .lore(ChatColor.GREEN + "Time Left: " + ChatColor.GOLD + (Math.round(abstractCooldown.getTimeLeft() * 10) / 10.0) + "s",
    // ChatColor.GREEN + "From: " + abstractCooldown.getFrom().getColoredName()
    // )
    // .get(),
    // (m, e) -> openCooldownMenu(player, target, abstractCooldown)
    // );
    // }
    menu.setItem(3, 5, MENU_BACK, (m, e) -> openCooldownsMenu(player, target));
    menu.setItem(4, 5, 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