Updated 'MdgaServer' class.

Updated the 'MdgaServer' class by updating the logic inside the 'connectionAdded' method in it.
This commit is contained in:
Daniel Grigencha
2024-12-02 22:37:46 +01:00
parent 492f7422f5
commit 1eb24b7a66

View File

@@ -216,7 +216,7 @@ 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());