Postpone settings load

This commit is contained in:
bluegreensea 2024-04-23 23:28:38 +08:00
parent 51fd8dad1d
commit 4235543dcb
No known key found for this signature in database
GPG Key ID: A8E2C7449431829D
2 changed files with 9 additions and 4 deletions

View File

@ -64,13 +64,16 @@ public class ViaFabricPlus {
directory.mkdir();
ClassLoaderPriorityUtil.loadOverridingJars(directory); // Load overriding jars first so other code can access the new classes
settingsManager = new SettingsManager();
saveManager = new SaveManager(settingsManager);
ClientsideFixes.init(); // Init clientside related fixes
loadingFuture = ProtocolTranslator.init(directory); // Init ViaVersion protocol translator platform
PostGameLoadCallback.EVENT.register(() -> loadingFuture.join()); // Block game loading until ViaVersion has loaded
settingsManager = new SettingsManager();
saveManager = new SaveManager(settingsManager);
PostGameLoadCallback.EVENT.register(() -> {
loadingFuture.join();
saveManager.init();
}); // Block game loading until ViaVersion has loaded
}
public static ViaFabricPlus global() {

View File

@ -43,7 +43,9 @@ public class SaveManager {
settingsSave = new SettingsSave(settingsManager),
accountsSave = new AccountsSave()
);
}
public void init() {
// Load save files
for (AbstractSave save : saves) {
save.init();