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();
}
Aggregations