diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java index 0a7df7d..9bfea69 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java @@ -228,4 +228,8 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga public MonopolyServer getMonopolyServer() { return monopolyServer; } + + public ServerConnection getServerConnection() { + return serverConnection; + } } diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java index d3529b0..489d0e2 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java @@ -70,7 +70,7 @@ public class CreateGameMenu { // "Selber hosten"-Button Button hostButton = buttonContainer.addChild(new Button("Selber hosten")); hostButton.setPreferredSize(new Vector3f(120, 40, 0)); - hostButton.addClickCommands(source -> app.startServer()); + hostButton.addClickCommands(source -> startServer()); // "Beitreten"-Button (vorerst funktionslos) Button joinButton = buttonContainer.addChild(new Button("Beitreten")); @@ -123,4 +123,10 @@ public class CreateGameMenu { app.getGuiNode().detachChild(background); // Entfernt das Hintergrundbild StartMenu.createStartMenu(app); } + + private void startServer() { + app.start(); + app.getServerConnection().connect(); + JOptionPane.showMessageDialog(null, "Server Started"); + } }