removed hostplayer as hostplayer always has id 0

This commit is contained in:
Johannes Schmelz 2024-11-26 18:48:13 +01:00
parent f4c4f6bc93
commit c71e8b1e8e
2 changed files with 1 additions and 13 deletions

View File

@ -19,7 +19,6 @@ public class PlayerHandler {
private List<Player> players = new LinkedList<>(); private List<Player> players = new LinkedList<>();
private Set<Player> readyPlayers = new HashSet<>(); private Set<Player> readyPlayers = new HashSet<>();
private transient ServerGameLogic logic; private transient ServerGameLogic logic;
private Player hostPlayer;
private Player extra = null; private Player extra = null;
/** /**
@ -55,14 +54,6 @@ public class PlayerHandler {
players.addAll(players); players.addAll(players);
} }
/**
* Return the host player
* @return the host player
*/
public Player getHostPlayer() {
return hostPlayer;
}
/** /**
* Return the number of players * Return the number of players
* @return number of players in the game * @return number of players in the game
@ -114,9 +105,6 @@ public class PlayerHandler {
throw new IllegalArgumentException("Player already registered"); throw new IllegalArgumentException("Player already registered");
} }
players.add(player); players.add(player);
if(hostPlayer == null) {
hostPlayer = player;
}
} }
/** /**

View File

@ -189,7 +189,7 @@ public class ServerGameLogic implements ClientInterpreter {
@Override @Override
public void received(PlayerReady msg, int from) { public void received(PlayerReady msg, int from) {
Player player = playerHandler.getPlayerById(from); Player player = playerHandler.getPlayerById(from);
if(player == playerHandler.getHostPlayer()) { if(player.getId() == 0) {
startMoney = msg.getStartMoney(); startMoney = msg.getStartMoney();
} }