add some Java8 magic to the server

This commit is contained in:
Ingmar Goudt 2019-01-19 09:31:50 +01:00
parent 9bea7c7df2
commit 50f28a2bf7
7 changed files with 46 additions and 56 deletions

View file

@ -334,10 +334,10 @@ public class User {
}
for (Iterator<Entry<UUID, UUID>> iterator = userTournaments.entrySet().iterator(); iterator.hasNext();) {
Entry<UUID, UUID> next = iterator.next();
TournamentController tournamentController = TournamentManager.instance.getTournamentController(next.getValue());
if (tournamentController != null) {
Optional<TournamentController> tournamentController = TournamentManager.instance.getTournamentController(next.getValue());
if (tournamentController.isPresent()) {
ccTournamentStarted(next.getValue(), next.getKey());
tournamentController.rejoin(next.getKey());
tournamentController.get().rejoin(next.getKey());
} else {
iterator.remove(); // tournament has ended meanwhile
}