fixed addPlayer

This commit is contained in:
Johannes Schmelz 2024-11-15 04:27:32 +01:00
parent 3bdfd6a78a
commit 10b978debf
2 changed files with 6 additions and 2 deletions

View File

@ -40,12 +40,16 @@ public class Player implements FieldVisitor<Void>{
private int rollResult; private int rollResult;
private PlayerHandler handler; private PlayerHandler handler;
Player(int id, String name, PlayerHandler handler) { public Player(int id, String name, PlayerHandler handler) {
this.name = name; this.name = name;
this.id = id; this.id = id;
this.handler = handler; this.handler = handler;
} }
public Player(int id) {
this.id = id;
}
public int getId() { public int getId() {
return id; return id;
} }

View File

@ -120,7 +120,7 @@ public class MonopolyServer implements MessageListener<HostedConnection>, Connec
@Override @Override
public void connectionAdded(Server server, HostedConnection hostedConnection) { public void connectionAdded(Server server, HostedConnection hostedConnection) {
LOGGER.log(Level.INFO, "new connection {0}", hostedConnection); //NON-NLS LOGGER.log(Level.INFO, "new connection {0}", hostedConnection); //NON-NLS
logic.addPlayer(hostedConnection.getId()); logic.addPlayer(new Player(hostedConnection.getId()));
} }
@Override @Override