From 47bac0185fd5068e264676bb52601a45ff9e4c67 Mon Sep 17 00:00:00 2001 From: Luca Puderbach Date: Wed, 20 Nov 2024 03:36:54 +0100 Subject: [PATCH] Port fix --- .../java/pp/battleship/client/NetworkDialog.java | 15 +++++++-------- .../main/java/pp/battleship/BattleshipConfig.java | 7 +++---- Projekte/battleship/server/server.properties | 2 +- .../java/pp/monopoly/client/NetworkDialog.java | 2 +- .../src/main/java/pp/monopoly/MonopolyConfig.java | 6 +++--- .../pp/monopoly/game/server/ServerGameLogic.java | 1 + Projekte/monopoly/server/server.properties | 2 +- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Projekte/battleship/client/src/main/java/pp/battleship/client/NetworkDialog.java b/Projekte/battleship/client/src/main/java/pp/battleship/client/NetworkDialog.java index 2e043c1..d9dde65 100644 --- a/Projekte/battleship/client/src/main/java/pp/battleship/client/NetworkDialog.java +++ b/Projekte/battleship/client/src/main/java/pp/battleship/client/NetworkDialog.java @@ -7,24 +7,23 @@ package pp.battleship.client; +import java.lang.System.Logger; +import java.lang.System.Logger.Level; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + import com.simsilica.lemur.Button; import com.simsilica.lemur.Container; import com.simsilica.lemur.Label; import com.simsilica.lemur.TextField; import com.simsilica.lemur.component.SpringGridLayout; +import static pp.battleship.Resources.lookup; import pp.battleship.server.BattleshipServer; import pp.dialog.Dialog; import pp.dialog.DialogBuilder; import pp.dialog.SimpleDialog; -import java.lang.System.Logger; -import java.lang.System.Logger.Level; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -import static pp.battleship.Resources.lookup; - /** * Represents a dialog for setting up a network connection in the Battleship game. * Allows users to specify the host and port for connecting to a game server. @@ -32,7 +31,7 @@ import static pp.battleship.Resources.lookup; class NetworkDialog extends SimpleDialog { private static final Logger LOGGER = System.getLogger(NetworkDialog.class.getName()); private static final String LOCALHOST = "localhost"; //NON-NLS - private static final String DEFAULT_PORT = "1234"; //NON-NLS + private static final String DEFAULT_PORT = "42069"; //NON-NLS private final NetworkSupport network; private final TextField host = new TextField(LOCALHOST); private final TextField port = new TextField(DEFAULT_PORT); diff --git a/Projekte/battleship/model/src/main/java/pp/battleship/BattleshipConfig.java b/Projekte/battleship/model/src/main/java/pp/battleship/BattleshipConfig.java index f6b4cf2..af4c63d 100644 --- a/Projekte/battleship/model/src/main/java/pp/battleship/BattleshipConfig.java +++ b/Projekte/battleship/model/src/main/java/pp/battleship/BattleshipConfig.java @@ -7,12 +7,11 @@ package pp.battleship; -import pp.util.config.Config; - +import static java.lang.Math.max; import java.util.Map; import java.util.TreeMap; -import static java.lang.Math.max; +import pp.util.config.Config; /** * Provides access to the configuration settings for the Battleship game. @@ -31,7 +30,7 @@ public class BattleshipConfig extends Config { * The default port number for the Battleship server. */ @Property("port") - private int port = 1234; + private int port = 12234; /** * The width of the game map in terms of grid units. diff --git a/Projekte/battleship/server/server.properties b/Projekte/battleship/server/server.properties index 9f168a6..1a03cec 100644 --- a/Projekte/battleship/server/server.properties +++ b/Projekte/battleship/server/server.properties @@ -10,7 +10,7 @@ # This file defines the configuration settings for the Battleship server. # # The port number on which the server will listen for incoming connections. -port=1234 +port=42069 # # The dimensions of the game map. # 'map.width' defines the number of columns, and 'map.height' defines the number of rows. diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/NetworkDialog.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/NetworkDialog.java index d399636..23bf5e6 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/NetworkDialog.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/NetworkDialog.java @@ -21,7 +21,7 @@ import pp.dialog.SimpleDialog; class NetworkDialog extends SimpleDialog { private static final Logger LOGGER = System.getLogger(NetworkDialog.class.getName()); private static final String LOCALHOST = "localhost"; - private static final String DEFAULT_PORT = "1234"; + private static final String DEFAULT_PORT = "42069"; private final NetworkSupport network; private final TextField host = new TextField(LOCALHOST); private final TextField port = new TextField(DEFAULT_PORT); diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/MonopolyConfig.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/MonopolyConfig.java index 41f14e9..2fe9495 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/MonopolyConfig.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/MonopolyConfig.java @@ -28,19 +28,19 @@ public class MonopolyConfig extends Config { * The default port number for the Monopoly server. */ @Property("port") - private int port = 42069; + private int port = 4321; /** * The width of the game map in terms of grid units. */ @Property("map.width") - private int mapWidth = 11; + private int mapWidth = 12; /** * The height of the game map in terms of grid units. */ @Property("map.height") - private int mapHeight = 11; + private int mapHeight = 12; /** * Creates an instance of {@code MonopolyConfig} with default settings. diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java index da3ca03..759cb38 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/ServerGameLogic.java @@ -124,6 +124,7 @@ public class ServerGameLogic implements ClientInterpreter { playerHandler.addPlayer(player); LOGGER.log(Level.DEBUG, "Player added: {0}", player.getId()); + System.out.println("Anzahl Spieler verbunden:"+ playerHandler.getPlayerCount()); return player; } diff --git a/Projekte/monopoly/server/server.properties b/Projekte/monopoly/server/server.properties index 2439842..53a2737 100644 --- a/Projekte/monopoly/server/server.properties +++ b/Projekte/monopoly/server/server.properties @@ -10,5 +10,5 @@ # This file defines the configuration settings for the Battleship server. # # The port number on which the server will listen for incoming connections. -port=1234 +port=42069