show all playe stats in toolbar

This commit is contained in:
Johannes Schmelz
2024-11-26 00:11:37 +01:00
parent 0e405d2f90
commit 3956d8efa7
3 changed files with 31 additions and 16 deletions

View File

@@ -3,6 +3,7 @@ package pp.monopoly.game.server;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Set;
@@ -15,7 +16,7 @@ import pp.monopoly.model.LimitedLinkedList;
*/
@Serializable
public class PlayerHandler {
private List<Player> players = new LimitedLinkedList<>(6);
private List<Player> players = new LinkedList<>();
private Set<Player> readyPlayers = new HashSet<>();
private transient ServerGameLogic logic;
private Player hostPlayer;
@@ -165,8 +166,10 @@ public class PlayerHandler {
* @return the player with the required id
*/
public Player getPlayerById(int id) {
System.out.println("TEST");
for (Player player : players) {
if (player.getId() == id) return player;
System.out.println(player.getId());
}
throw new NoSuchElementException("Player mit id "+id+" existiert nicht");
}