This commit is contained in:
Luca Puderbach 2024-11-20 03:36:54 +01:00
parent 1203077aed
commit 47bac0185f
7 changed files with 17 additions and 18 deletions

View File

@ -7,24 +7,23 @@
package pp.battleship.client; 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.Button;
import com.simsilica.lemur.Container; import com.simsilica.lemur.Container;
import com.simsilica.lemur.Label; import com.simsilica.lemur.Label;
import com.simsilica.lemur.TextField; import com.simsilica.lemur.TextField;
import com.simsilica.lemur.component.SpringGridLayout; import com.simsilica.lemur.component.SpringGridLayout;
import static pp.battleship.Resources.lookup;
import pp.battleship.server.BattleshipServer; import pp.battleship.server.BattleshipServer;
import pp.dialog.Dialog; import pp.dialog.Dialog;
import pp.dialog.DialogBuilder; import pp.dialog.DialogBuilder;
import pp.dialog.SimpleDialog; 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. * 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. * 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 { class NetworkDialog extends SimpleDialog {
private static final Logger LOGGER = System.getLogger(NetworkDialog.class.getName()); private static final Logger LOGGER = System.getLogger(NetworkDialog.class.getName());
private static final String LOCALHOST = "localhost"; //NON-NLS 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 NetworkSupport network;
private final TextField host = new TextField(LOCALHOST); private final TextField host = new TextField(LOCALHOST);
private final TextField port = new TextField(DEFAULT_PORT); private final TextField port = new TextField(DEFAULT_PORT);

View File

@ -7,12 +7,11 @@
package pp.battleship; package pp.battleship;
import pp.util.config.Config; import static java.lang.Math.max;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; 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. * 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. * The default port number for the Battleship server.
*/ */
@Property("port") @Property("port")
private int port = 1234; private int port = 12234;
/** /**
* The width of the game map in terms of grid units. * The width of the game map in terms of grid units.

View File

@ -10,7 +10,7 @@
# This file defines the configuration settings for the Battleship server. # This file defines the configuration settings for the Battleship server.
# #
# The port number on which the server will listen for incoming connections. # The port number on which the server will listen for incoming connections.
port=1234 port=42069
# #
# The dimensions of the game map. # The dimensions of the game map.
# 'map.width' defines the number of columns, and 'map.height' defines the number of rows. # 'map.width' defines the number of columns, and 'map.height' defines the number of rows.

View File

@ -21,7 +21,7 @@ import pp.dialog.SimpleDialog;
class NetworkDialog extends SimpleDialog { class NetworkDialog extends SimpleDialog {
private static final Logger LOGGER = System.getLogger(NetworkDialog.class.getName()); private static final Logger LOGGER = System.getLogger(NetworkDialog.class.getName());
private static final String LOCALHOST = "localhost"; 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 NetworkSupport network;
private final TextField host = new TextField(LOCALHOST); private final TextField host = new TextField(LOCALHOST);
private final TextField port = new TextField(DEFAULT_PORT); private final TextField port = new TextField(DEFAULT_PORT);

View File

@ -28,19 +28,19 @@ public class MonopolyConfig extends Config {
* The default port number for the Monopoly server. * The default port number for the Monopoly server.
*/ */
@Property("port") @Property("port")
private int port = 42069; private int port = 4321;
/** /**
* The width of the game map in terms of grid units. * The width of the game map in terms of grid units.
*/ */
@Property("map.width") @Property("map.width")
private int mapWidth = 11; private int mapWidth = 12;
/** /**
* The height of the game map in terms of grid units. * The height of the game map in terms of grid units.
*/ */
@Property("map.height") @Property("map.height")
private int mapHeight = 11; private int mapHeight = 12;
/** /**
* Creates an instance of {@code MonopolyConfig} with default settings. * Creates an instance of {@code MonopolyConfig} with default settings.

View File

@ -124,6 +124,7 @@ public class ServerGameLogic implements ClientInterpreter {
playerHandler.addPlayer(player); playerHandler.addPlayer(player);
LOGGER.log(Level.DEBUG, "Player added: {0}", player.getId()); LOGGER.log(Level.DEBUG, "Player added: {0}", player.getId());
System.out.println("Anzahl Spieler verbunden:"+ playerHandler.getPlayerCount());
return player; return player;
} }

View File

@ -10,5 +10,5 @@
# This file defines the configuration settings for the Battleship server. # This file defines the configuration settings for the Battleship server.
# #
# The port number on which the server will listen for incoming connections. # The port number on which the server will listen for incoming connections.
port=1234 port=42069