workaround: 将Settings中的Config字段改为静态
This commit is contained in:
@@ -74,10 +74,9 @@ public class Settings {
|
|||||||
public static final String SETTINGS_FILE_NAME = "hmcl.json";
|
public static final String SETTINGS_FILE_NAME = "hmcl.json";
|
||||||
public static final File SETTINGS_FILE = new File(SETTINGS_FILE_NAME).getAbsoluteFile();
|
public static final File SETTINGS_FILE = new File(SETTINGS_FILE_NAME).getAbsoluteFile();
|
||||||
|
|
||||||
public static final Settings INSTANCE = new Settings();
|
public static final Config SETTINGS = initSettings();
|
||||||
|
|
||||||
// TODO: another way to access this property aside from Settings.INSTANCE.SETTINGS
|
public static final Settings INSTANCE = new Settings();
|
||||||
public final Config SETTINGS = initSettings();
|
|
||||||
|
|
||||||
private final Map<String, Account> accounts = new ConcurrentHashMap<>();
|
private final Map<String, Account> accounts = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@@ -122,7 +121,7 @@ public class Settings {
|
|||||||
Lang.ignoringException(() -> Runtime.getRuntime().addShutdownHook(new Thread(this::save)));
|
Lang.ignoringException(() -> Runtime.getRuntime().addShutdownHook(new Thread(this::save)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Config initSettings() {
|
private static Config initSettings() {
|
||||||
Config c = new Config();
|
Config c = new Config();
|
||||||
if (SETTINGS_FILE.exists())
|
if (SETTINGS_FILE.exists())
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user