changed the logic so that the isHost is not decided by the client and instead by the server

This commit is contained in:
Fleischer Hanno
2024-12-02 22:45:44 +01:00
parent e163b87cc4
commit e9ba888651
7 changed files with 51 additions and 76 deletions

View File

@@ -100,6 +100,7 @@ private void mainMenu() {
private void tryHost() {
int port = 0;
String text = hostDialog.getPort();
app.getGameLogic().selectHost("");
try {
port = Integer.parseInt(text);
@@ -113,7 +114,6 @@ private void tryHost() {
}
hostDialog.connectServerAsClient();
app.getModelSynchronize().setHost(port);
app.getGameLogic().selectHost("");
//app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
return;
}
@@ -128,6 +128,7 @@ private void tryJoin() {
int port = 0;
String ip = joinDialog.getIpt();
String portText = joinDialog.getPort();
app.getGameLogic().selectJoin("");
try {
// Validate the port
@@ -141,7 +142,6 @@ private void tryJoin() {
app.getModelSynchronize().setName(startDialog.getName());
joinDialog.setHostname(ip);
joinDialog.connectToServer();
app.getGameLogic().selectJoin("");
return;
}
} catch (IllegalArgumentException e) {