From b92e9a1d2955682e6be6d75df22def19fbea9642 Mon Sep 17 00:00:00 2001 From: Gravit Date: Fri, 3 Jul 2020 07:38:01 +0700 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20SaveProfilesCommand=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B4=D0=B4=D0=B5=D1=80=D0=B6=D0=BA=D0=B0=20ServerProfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../launchserver/command/hash/SaveProfilesCommand.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SaveProfilesCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SaveProfilesCommand.java index c628a4be..adc9bcf5 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SaveProfilesCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/hash/SaveProfilesCommand.java @@ -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); }