From f4d511040f43b1e775264ace852469cbf04ecf0e Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Thu, 2 Nov 2023 01:11:09 +0700 Subject: [PATCH 01/15] [FIX] uploadAsset proguard --- .../launcher/client/gui/overlays/UploadAssetOverlay.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/pro/gravit/launcher/client/gui/overlays/UploadAssetOverlay.java b/src/main/java/pro/gravit/launcher/client/gui/overlays/UploadAssetOverlay.java index 35d72e17..ce1c9e2d 100644 --- a/src/main/java/pro/gravit/launcher/client/gui/overlays/UploadAssetOverlay.java +++ b/src/main/java/pro/gravit/launcher/client/gui/overlays/UploadAssetOverlay.java @@ -4,6 +4,7 @@ import javafx.scene.control.CheckBox; import javafx.stage.FileChooser; import pro.gravit.launcher.Launcher; +import pro.gravit.launcher.LauncherNetworkAPI; import pro.gravit.launcher.client.gui.JavaFXApplication; import pro.gravit.launcher.client.gui.helper.LookupHelper; import pro.gravit.launcher.events.request.AssetUploadInfoRequestEvent; @@ -171,7 +172,7 @@ public record UploadError(String error) { } - public record UserTexture(String url, String digest, Map metadata) { + public record UserTexture(@LauncherNetworkAPI String url,@LauncherNetworkAPI String digest,@LauncherNetworkAPI Map metadata) { Texture toLauncherTexture() { return new Texture(url, SecurityHelper.fromHex(digest), metadata); From 0e3314f9683375d415e523d154fe7ac71e5633cf Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Thu, 2 Nov 2023 04:07:52 +0700 Subject: [PATCH 02/15] [FIX] Skin upload --- .../gravit/launcher/client/gui/overlays/UploadAssetOverlay.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/pro/gravit/launcher/client/gui/overlays/UploadAssetOverlay.java b/src/main/java/pro/gravit/launcher/client/gui/overlays/UploadAssetOverlay.java index ce1c9e2d..ead282e4 100644 --- a/src/main/java/pro/gravit/launcher/client/gui/overlays/UploadAssetOverlay.java +++ b/src/main/java/pro/gravit/launcher/client/gui/overlays/UploadAssetOverlay.java @@ -156,6 +156,7 @@ public void uploadAsset(String name, AssetOptions options) { } public static final class AssetOptions { + @LauncherNetworkAPI private final boolean modelSlim; public AssetOptions(boolean modelSlim) { From 3c2b696ad52c15fa2278100a0b083aeaf2e69694 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Thu, 2 Nov 2023 04:08:50 +0700 Subject: [PATCH 03/15] [FIX] Skin upload error --- .../gravit/launcher/client/gui/overlays/UploadAssetOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/pro/gravit/launcher/client/gui/overlays/UploadAssetOverlay.java b/src/main/java/pro/gravit/launcher/client/gui/overlays/UploadAssetOverlay.java index ead282e4..298c4b0f 100644 --- a/src/main/java/pro/gravit/launcher/client/gui/overlays/UploadAssetOverlay.java +++ b/src/main/java/pro/gravit/launcher/client/gui/overlays/UploadAssetOverlay.java @@ -169,7 +169,7 @@ public boolean modelSlim() { } - public record UploadError(String error) { + public record UploadError(@LauncherNetworkAPI String error) { } From 27df89b21ab141bb998cea805723a24b8056c1ba Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Thu, 2 Nov 2023 04:11:04 +0700 Subject: [PATCH 04/15] [FIX] Avatar position --- runtime/scenes/serverinfo/serverinfo.fxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/scenes/serverinfo/serverinfo.fxml b/runtime/scenes/serverinfo/serverinfo.fxml index 57ea07d7..0a684098 100644 --- a/runtime/scenes/serverinfo/serverinfo.fxml +++ b/runtime/scenes/serverinfo/serverinfo.fxml @@ -74,7 +74,7 @@ - + From 40fb38875e394cdf8f340fa5072b064c88e1c696 Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Thu, 2 Nov 2023 04:23:38 +0700 Subject: [PATCH 05/15] [FIX] options.json --- .../gui/scenes/options/OptionsScene.java | 32 ---------- .../client/gui/service/ProfilesService.java | 59 +++++++++++++++---- 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/src/main/java/pro/gravit/launcher/client/gui/scenes/options/OptionsScene.java b/src/main/java/pro/gravit/launcher/client/gui/scenes/options/OptionsScene.java index 22b9e193..992068c2 100644 --- a/src/main/java/pro/gravit/launcher/client/gui/scenes/options/OptionsScene.java +++ b/src/main/java/pro/gravit/launcher/client/gui/scenes/options/OptionsScene.java @@ -1,6 +1,5 @@ package pro.gravit.launcher.client.gui.scenes.options; -import javafx.application.Platform; import javafx.geometry.Insets; import javafx.scene.control.*; import javafx.scene.layout.HBox; @@ -152,35 +151,4 @@ public Consumer add(String tab, String name, String description, boolea return checkBox::setSelected; } - public static class OptionalListEntryPair { - public String name; - public boolean mark; - public OptionalView.OptionalFileInstallInfo installInfo; - - public OptionalListEntryPair(OptionalFile optionalFile, boolean enabled, - OptionalView.OptionalFileInstallInfo installInfo) { - name = optionalFile.name; - mark = enabled; - this.installInfo = installInfo; - } - } - - public static class OptionalListEntry { - public List enabled = new LinkedList<>(); - public String name; - public UUID profileUUID; - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - OptionalListEntry that = (OptionalListEntry) o; - return Objects.equals(profileUUID, that.profileUUID) && Objects.equals(name, that.name); - } - - @Override - public int hashCode() { - return Objects.hash(name, profileUUID); - } - } } diff --git a/src/main/java/pro/gravit/launcher/client/gui/service/ProfilesService.java b/src/main/java/pro/gravit/launcher/client/gui/service/ProfilesService.java index c8735edd..f1f0f88d 100644 --- a/src/main/java/pro/gravit/launcher/client/gui/service/ProfilesService.java +++ b/src/main/java/pro/gravit/launcher/client/gui/service/ProfilesService.java @@ -2,8 +2,8 @@ import com.google.gson.reflect.TypeToken; import pro.gravit.launcher.Launcher; +import pro.gravit.launcher.LauncherNetworkAPI; import pro.gravit.launcher.client.DirBridge; -import pro.gravit.launcher.client.gui.scenes.options.OptionsScene; import pro.gravit.launcher.events.request.ProfilesRequestEvent; import pro.gravit.launcher.profiles.ClientProfile; import pro.gravit.launcher.profiles.optional.OptionalFile; @@ -17,10 +17,7 @@ import java.lang.reflect.Type; import java.nio.file.Files; import java.nio.file.Path; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class ProfilesService { private List profiles; @@ -73,9 +70,9 @@ public void setProfile(ClientProfile profile) { public void saveAll() throws IOException { if (profiles == null) return; Path optionsFile = DirBridge.dir.resolve("options.json"); - List list = new ArrayList<>(5); + List list = new ArrayList<>(5); for (ClientProfile clientProfile : profiles) { - OptionsScene.OptionalListEntry entry = new OptionsScene.OptionalListEntry(); + OptionalListEntry entry = new OptionalListEntry(); entry.name = clientProfile.getTitle(); entry.profileUUID = clientProfile.getUUID(); OptionalView view = optionalViewMap.get(clientProfile); @@ -83,7 +80,7 @@ public void saveAll() throws IOException { if (optionalFile.visible) { boolean isEnabled = view.enabled.contains(optionalFile); OptionalView.OptionalFileInstallInfo installInfo = view.installInfo.get(optionalFile); - entry.enabled.add(new OptionsScene.OptionalListEntryPair(optionalFile, isEnabled, installInfo)); + entry.enabled.add(new OptionalListEntryPair(optionalFile, isEnabled, installInfo)); } })); list.add(entry); @@ -98,12 +95,12 @@ public void loadAll() throws IOException { Path optionsFile = DirBridge.dir.resolve("options.json"); if (!Files.exists(optionsFile)) return; - Type collectionType = new TypeToken>() { + Type collectionType = new TypeToken>() { }.getType(); try (Reader reader = IOHelper.newReader(optionsFile)) { - List list = Launcher.gsonManager.gson.fromJson(reader, collectionType); - for (OptionsScene.OptionalListEntry entry : list) { + List list = Launcher.gsonManager.gson.fromJson(reader, collectionType); + for (OptionalListEntry entry : list) { ClientProfile selectedProfile = null; for (ClientProfile clientProfile : profiles) { if (entry.profileUUID != null @@ -115,7 +112,7 @@ public void loadAll() throws IOException { continue; } OptionalView view = optionalViewMap.get(selectedProfile); - for (OptionsScene.OptionalListEntryPair entryPair : entry.enabled) { + for (OptionalListEntryPair entryPair : entry.enabled) { try { OptionalFile file = selectedProfile.getOptionalFile(entryPair.name); if (file.visible) { @@ -132,4 +129,42 @@ public void loadAll() throws IOException { } } } + + public static class OptionalListEntryPair { + @LauncherNetworkAPI + public String name; + @LauncherNetworkAPI + public boolean mark; + @LauncherNetworkAPI + public OptionalView.OptionalFileInstallInfo installInfo; + + public OptionalListEntryPair(OptionalFile optionalFile, boolean enabled, + OptionalView.OptionalFileInstallInfo installInfo) { + name = optionalFile.name; + mark = enabled; + this.installInfo = installInfo; + } + } + + public static class OptionalListEntry { + @LauncherNetworkAPI + public List enabled = new LinkedList<>(); + @LauncherNetworkAPI + public String name; + @LauncherNetworkAPI + public UUID profileUUID; + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + OptionalListEntry that = (OptionalListEntry) o; + return Objects.equals(profileUUID, that.profileUUID) && Objects.equals(name, that.name); + } + + @Override + public int hashCode() { + return Objects.hash(name, profileUUID); + } + } } \ No newline at end of file From de079a6a2adb88c5c4c1ce514277aa893bb9a4af Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Thu, 2 Nov 2023 19:29:31 +0700 Subject: [PATCH 06/15] [FIX] Server description --- runtime/scenes/serverinfo/serverinfo.fxml | 2 +- .../client/gui/scenes/serverinfo/ServerInfoScene.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/runtime/scenes/serverinfo/serverinfo.fxml b/runtime/scenes/serverinfo/serverinfo.fxml index 0a684098..799c34bc 100644 --- a/runtime/scenes/serverinfo/serverinfo.fxml +++ b/runtime/scenes/serverinfo/serverinfo.fxml @@ -92,7 +92,7 @@ - + diff --git a/src/main/java/pro/gravit/launcher/client/gui/scenes/serverinfo/ServerInfoScene.java b/src/main/java/pro/gravit/launcher/client/gui/scenes/serverinfo/ServerInfoScene.java index 057d2464..8574935a 100644 --- a/src/main/java/pro/gravit/launcher/client/gui/scenes/serverinfo/ServerInfoScene.java +++ b/src/main/java/pro/gravit/launcher/client/gui/scenes/serverinfo/ServerInfoScene.java @@ -4,6 +4,7 @@ import javafx.scene.control.Button; import javafx.scene.control.ButtonBase; import javafx.scene.control.Label; +import javafx.scene.control.ScrollPane; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.Pane; @@ -73,8 +74,10 @@ public void reset() { avatar.setImage(originalAvatarImage); ClientProfile profile = application.profilesService.getProfile(); LookupHelper.