diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/profiles/LocalProfilesProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/profiles/LocalProfilesProvider.java index 311c4453..8044c96b 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/profiles/LocalProfilesProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/profiles/LocalProfilesProvider.java @@ -60,12 +60,7 @@ public UncompletedProfile create(String name, String description, CompletedProfi .setAssetDir("assets") .createClientProfile(), null, getUpdatesDir("assets")); } - profilesMap.put(profile.getUuid(), profile); - try(Writer writer = IOHelper.newWriter(profile.getConfigPath())) { - Launcher.gsonManager.configGson.toJson(profile.profile, writer); - } catch (IOException e) { - throw new RuntimeException(e); - } + pushProfileAndSave(profile); return profile; } @@ -103,10 +98,19 @@ public CompletedProfile pushUpdate(UncompletedProfile profile, String tag, Clien execute(localProfile.clientDir, clientDir, clientActions); localProfile.clientDir = new HashedDir(clientDir, null, true, true); } - profilesMap.put(localProfile.getUuid(), localProfile); + pushProfileAndSave(localProfile); return localProfile; } + private void pushProfileAndSave(LocalProfile localProfile) { + profilesMap.put(localProfile.getUuid(), localProfile); + try(Writer writer = IOHelper.newWriter(localProfile.getConfigPath())) { + Launcher.gsonManager.configGson.toJson(localProfile.profile, writer); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + @Override public void download(CompletedProfile profile, Map files, boolean assets) throws IOException { Path sourceDir = Path.of(updatesDir).resolve(assets ? profile.getProfile().getAssetDir() : profile.getProfile().getDir());