Search in sources :

Example 11 with Classes

use of com.ebicep.warlords.player.Classes in project Warlords by ebicep.

the class RegularGamesMenu method swapPlayers.

private void swapPlayers(Team team) {
    Optional<RegularGamePlayer> regularGamePlayer1 = regularGamePlayers.stream().filter(regularGamePlayer -> regularGamePlayer.getUuid().equals(selectedPlayersToSwap.get(team).get(0))).findFirst();
    Optional<RegularGamePlayer> regularGamePlayer2 = regularGamePlayers.stream().filter(regularGamePlayer -> regularGamePlayer.getUuid().equals(selectedPlayersToSwap.get(team).get(1))).findFirst();
    if (!regularGamePlayer1.isPresent() || !regularGamePlayer2.isPresent())
        return;
    Classes classToSwap = regularGamePlayer1.get().getSelectedClass();
    regularGamePlayer1.get().setSelectedClass(regularGamePlayer2.get().getSelectedClass());
    regularGamePlayer2.get().setSelectedClass(classToSwap);
    selectedPlayersToSwap.get(team).clear();
}
Also used : ClassesGroup(com.ebicep.warlords.player.ClassesGroup) Menu(com.ebicep.warlords.menu.Menu) PermissionHandler(com.ebicep.warlords.permissions.PermissionHandler) java.util(java.util) Team(com.ebicep.warlords.game.Team) Warlords(com.ebicep.warlords.Warlords) DatabaseManager(com.ebicep.warlords.database.DatabaseManager) Player(org.bukkit.entity.Player) DatabasePlayer(com.ebicep.warlords.database.repositories.player.pojos.general.DatabasePlayer) SpecType(com.ebicep.warlords.player.SpecType) Collectors(java.util.stream.Collectors) org.bukkit(org.bukkit) ItemStack(org.bukkit.inventory.ItemStack) ItemBuilder(com.ebicep.warlords.util.bukkit.ItemBuilder) Classes(com.ebicep.warlords.player.Classes) Classes(com.ebicep.warlords.player.Classes)

Aggregations

Classes (com.ebicep.warlords.player.Classes)11 ItemBuilder (com.ebicep.warlords.util.bukkit.ItemBuilder)10 ItemStack (org.bukkit.inventory.ItemStack)9 Player (org.bukkit.entity.Player)6 Warlords (com.ebicep.warlords.Warlords)5 AbstractPlayerClass (com.ebicep.warlords.classes.AbstractPlayerClass)5 DatabasePlayer (com.ebicep.warlords.database.repositories.player.pojos.general.DatabasePlayer)5 Team (com.ebicep.warlords.game.Team)5 Collectors (java.util.stream.Collectors)5 DatabaseManager (com.ebicep.warlords.database.DatabaseManager)3 java.util (java.util)3 org.bukkit (org.bukkit)3 Menu (com.ebicep.warlords.menu.Menu)2 PermissionHandler (com.ebicep.warlords.permissions.PermissionHandler)2 ClassesGroup (com.ebicep.warlords.player.ClassesGroup)2 SpecType (com.ebicep.warlords.player.SpecType)2 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 List (java.util.List)2 UUID (java.util.UUID)2