This commit is contained in:
Cedric Beck
2024-12-02 22:43:16 +01:00
3 changed files with 40 additions and 3 deletions

View File

@@ -216,10 +216,12 @@ public void connectionAdded(Server server, HostedConnection hostedConnection) {
this.logic.getServerSender().send(hostedConnection.getId(), new LobbyDenyMessage());
hostedConnection.close("");
} else {
if (this.myServer.getConnections().size() == 1) {
if (hostedConnection.getAddress().contains("127.0.0.1") && this.logic.getGame().getHost() == -1) {
this.logic.getGame().setHost(hostedConnection.getId());
this.logic.getServerSender().send(hostedConnection.getId(), new LobbyAcceptMessage(hostedConnection.getId()));
} else {
this.logic.getServerSender().send(hostedConnection.getId(), new LobbyAcceptMessage());
}
this.logic.getServerSender().send(hostedConnection.getId(), new LobbyAcceptMessage());
}
}