Merge branch 'development' into 'dev/test'

Updated 'Game' class.

See merge request progproj/gruppen-ht24/Gruppe-01!32
This commit is contained in:
Benjamin Feyer
2024-12-02 00:55:01 +00:00
2 changed files with 29 additions and 1 deletions

View File

@@ -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);
}
}

View File

@@ -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.
*