blob: 7e3c5f9cb964ddafd8320b82c6e9e47394d0ea11 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package de.torui.coflsky.configuration;
import com.google.gson.Gson;
import de.torui.coflsky.gui.GUIType;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
public class LocalConfig {
public boolean autoStart;
public boolean extendedtooltips;
public GUIType purchaseOverlay;
public LocalConfig(boolean autoStart, boolean extendedtooltips, GUIType purchaseOverlay) {
this.autoStart = autoStart;
this.extendedtooltips = extendedtooltips;
this.purchaseOverlay = purchaseOverlay;
}
public static void saveConfig(File file, LocalConfig Config) {
Gson gson = new Gson();
try {
if (!file.isFile()) {
file.createNewFile();
}
Files.write(Paths.get(file.getAbsolutePath()),
gson.toJson(Config).getBytes(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
}
public static LocalConfig createDefaultConfig() {
return new LocalConfig(true, true, null);
}
}
|