Start leaguifying
[troll.git] / src / main / java / com / codingame / game / GameManager.java
1 package com.codingame.game;
2
3 import java.util.List;
4 import java.util.stream.Collectors;
5
6 import com.codingame.gameengine.core.MultiplayerGameManager;
7 import com.google.inject.Inject;
8 import com.google.inject.Singleton;
9
10 @Singleton
11 public class GameManager {
12     @Inject private MultiplayerGameManager<Player> gameManager;
13
14     Player getPlayer(int index) { return gameManager.getPlayer(index); }
15     List<Player> getPlayers() { return gameManager.getPlayers(); }
16     List<Player> getActivePlayers() {
17         return gameManager.getPlayers().stream()
18             .filter(p -> p.isActive() && !p.model.hit)
19             .collect(Collectors.toList());
20     }
21
22     void endGame() { gameManager.endGame(); }
23 }