From efb44394313d0ead337a3a56c692a689a3adfa05 Mon Sep 17 00:00:00 2001 From: Daniel Grigencha Date: Mon, 2 Dec 2024 01:53:10 +0100 Subject: [PATCH 1/2] Updated 'Game' class. Updated the 'Game' class by adding the 'setDie' method to it. --- Projekte/mdga/model/src/main/java/pp/mdga/game/Game.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/game/Game.java b/Projekte/mdga/model/src/main/java/pp/mdga/game/Game.java index ac97b92e..666f1b8b 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/game/Game.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/game/Game.java @@ -316,6 +316,15 @@ public void setActiveColor(Color activeColor) { this.activeColor = activeColor; } + /** + * This method will be used to set die attribute of Game class to the given die parameter. + * + * @param die as the new value of die as a Die object. + */ + public void setDie(Die die) { + this.die = die; + } + /** * This method will be used to set host attribute of Game class to the given host parameter. * -- 2.43.0 From c5cb3d4dd0d97a9d0576db5c712edfe4b5ae15c7 Mon Sep 17 00:00:00 2001 From: Felix Koppe Date: Mon, 2 Dec 2024 01:59:37 +0100 Subject: [PATCH 2/2] Add restart on resolution change --- .../src/main/java/pp/mdga/client/MdgaApp.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/MdgaApp.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/MdgaApp.java index 58ec4806..80a44dbd 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/MdgaApp.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/MdgaApp.java @@ -10,6 +10,7 @@ import pp.mdga.client.view.*; import pp.mdga.message.server.ServerInterpreter; +import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.prefs.Preferences; @@ -263,7 +264,25 @@ public void updateResolution(int width, int height, float imageFactor) { prefs.putInt("height", height); prefs.putFloat("scale", imageFactor); - stop(); + try { + restartApp(); + } catch (Exception e) { + //nothing + } + } + + public static void restartApp() throws IOException { + String javaBin = System.getProperty("java.home") + "/bin/java"; + String classPath = System.getProperty("java.class.path"); + String className = System.getProperty("sun.java.command"); + + ProcessBuilder builder = new ProcessBuilder( + javaBin, "-cp", classPath, className + ); + + builder.start(); + + System.exit(0); } } -- 2.43.0