mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-29 08:59:44 +01:00
removed hostplayer as hostplayer always has id 0
This commit is contained in:
parent
f4c4f6bc93
commit
c71e8b1e8e
@ -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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user