mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FEATURE] SaveProfilesCommand поддержка ServerProfile
This commit is contained in:
parent
4bea6bb16b
commit
b92e9a1d29
1 changed files with 10 additions and 0 deletions
|
@ -19,8 +19,18 @@ public SaveProfilesCommand(LaunchServer server) {
|
|||
super(server);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecated")
|
||||
public static void saveProfile(ClientProfile profile, Path path) throws IOException {
|
||||
if (profile.getUUID() == null) profile.setUUID(UUID.randomUUID());
|
||||
if(profile.getServers().size() == 0)
|
||||
{
|
||||
ClientProfile.ServerProfile serverProfile = new ClientProfile.ServerProfile();
|
||||
serverProfile.isDefault = true;
|
||||
serverProfile.name = profile.getTitle();
|
||||
serverProfile.serverAddress = profile.getServerAddress();
|
||||
serverProfile.serverPort = profile.getServerPort();
|
||||
profile.getServers().add(serverProfile);
|
||||
}
|
||||
try (Writer w = IOHelper.newWriter(path)) {
|
||||
Launcher.gsonManager.configGson.toJson(profile, w);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue