From c74f4301290d27002d3ec742cfe8916d001a9fbe Mon Sep 17 00:00:00 2001 From: Gravita Date: Mon, 17 Oct 2022 00:47:24 +0700 Subject: [PATCH] [FIX] Paper installAuthlib --- .../server/authlib/InstallAuthlib.java | 1 + .../server/authlib/PatchesLstModifier.java | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 ServerWrapper/src/main/java/pro/gravit/launcher/server/authlib/PatchesLstModifier.java diff --git a/ServerWrapper/src/main/java/pro/gravit/launcher/server/authlib/InstallAuthlib.java b/ServerWrapper/src/main/java/pro/gravit/launcher/server/authlib/InstallAuthlib.java index b880d880..c671b706 100644 --- a/ServerWrapper/src/main/java/pro/gravit/launcher/server/authlib/InstallAuthlib.java +++ b/ServerWrapper/src/main/java/pro/gravit/launcher/server/authlib/InstallAuthlib.java @@ -20,6 +20,7 @@ public class InstallAuthlib { modifierMap.put("META-INF/libraries.list", new LibrariesLstModifier()); modifierMap.put("patch.properties", new PatchPropertiesModifier()); modifierMap.put("META-INF/download-context", new DownloadContextModifier()); + modifierMap.put("META-INF/patches.list", new PatchesLstModifier()); } public void run(String... args) throws Exception { boolean deleteAuthlibAfterInstall = false; diff --git a/ServerWrapper/src/main/java/pro/gravit/launcher/server/authlib/PatchesLstModifier.java b/ServerWrapper/src/main/java/pro/gravit/launcher/server/authlib/PatchesLstModifier.java new file mode 100644 index 00000000..51eaa516 --- /dev/null +++ b/ServerWrapper/src/main/java/pro/gravit/launcher/server/authlib/PatchesLstModifier.java @@ -0,0 +1,29 @@ +package pro.gravit.launcher.server.authlib; + +import pro.gravit.utils.helper.LogHelper; +import pro.gravit.utils.helper.SecurityHelper; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; + +public class PatchesLstModifier implements LibrariesHashFileModifier { + @Override + public byte[] apply(byte[] data, InstallAuthlib.InstallAuthlibContext context) throws IOException { + String[] lines = new String(data).split("\n"); + for(int i=0;i