From dcf9a56c010dc34ea16baaa25afbc4a9c48c337f Mon Sep 17 00:00:00 2001 From: Zaxar163 Date: Tue, 17 Dec 2019 06:46:55 +0100 Subject: [PATCH] =?UTF-8?q?[ANY]=20=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../binary/tasks/CertificateAutogenTask.java | 1 - .../pro/gravit/launcher/LauncherEngine.java | 3 +-- .../gravit/launcher/NewLauncherSettings.java | 1 - .../launcher/client/ClientLauncher.java | 2 -- .../client/LauncherUpdateController.java | 5 +---- .../modules/impl/SimpleModuleManager.java | 1 - .../pro/gravit/launcher/request/Request.java | 1 - .../websockets/ClientWebSocketService.java | 1 - .../websockets/StdWebSocketService.java | 6 ++++-- .../pro/gravit/launcher/AsyncDownloader.java | 21 +++++++++++++------ .../java/pro/gravit/launcher/HTTPRequest.java | 2 -- modules | 2 +- 12 files changed, 22 insertions(+), 24 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/CertificateAutogenTask.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/CertificateAutogenTask.java index 5301903c..e26cd640 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/CertificateAutogenTask.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/CertificateAutogenTask.java @@ -1,6 +1,5 @@ package pro.gravit.launchserver.binary.tasks; -import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.x500.X500Name; import org.bouncycastle.asn1.x500.X500NameBuilder; import org.bouncycastle.asn1.x500.style.BCStyle; diff --git a/Launcher/src/main/java/pro/gravit/launcher/LauncherEngine.java b/Launcher/src/main/java/pro/gravit/launcher/LauncherEngine.java index f2c2421e..e9c9a0e8 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/LauncherEngine.java +++ b/Launcher/src/main/java/pro/gravit/launcher/LauncherEngine.java @@ -12,7 +12,6 @@ import pro.gravit.launcher.managers.ClientGsonManager; import pro.gravit.launcher.managers.ClientHookManager; import pro.gravit.launcher.managers.ConsoleManager; -import pro.gravit.launcher.modules.events.ClosePhase; import pro.gravit.launcher.modules.events.PreConfigPhase; import pro.gravit.launcher.request.Request; import pro.gravit.launcher.request.RequestException; @@ -88,7 +87,7 @@ public static void main(String... args) throws Throwable { ConsoleManager.initConsole(); HWIDProvider.registerHWIDs(); LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase()); - LauncherConfig config = Launcher.getConfig(); + Launcher.getConfig(); // init config long startTime = System.currentTimeMillis(); try { new LauncherEngine().start(args); diff --git a/Launcher/src/main/java/pro/gravit/launcher/NewLauncherSettings.java b/Launcher/src/main/java/pro/gravit/launcher/NewLauncherSettings.java index f95be120..1c78e9c9 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/NewLauncherSettings.java +++ b/Launcher/src/main/java/pro/gravit/launcher/NewLauncherSettings.java @@ -2,7 +2,6 @@ import pro.gravit.launcher.client.UserSettings; import pro.gravit.launcher.hasher.HashedDir; -import pro.gravit.launcher.profiles.ClientProfile; import java.nio.file.Path; import java.util.*; diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java index 9fe5a32e..2905bfd2 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java @@ -22,8 +22,6 @@ import pro.gravit.launcher.serialize.HOutput; import pro.gravit.launcher.serialize.stream.StreamObject; import pro.gravit.launcher.utils.DirWatcher; -import pro.gravit.launcher.utils.NativeJVMHalt; -import pro.gravit.utils.PublicURLClassLoader; import pro.gravit.utils.Version; import pro.gravit.utils.helper.*; import pro.gravit.utils.helper.JVMHelper.OS; diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/LauncherUpdateController.java b/Launcher/src/main/java/pro/gravit/launcher/client/LauncherUpdateController.java index 599dc121..74ebd59a 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/LauncherUpdateController.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/LauncherUpdateController.java @@ -5,18 +5,15 @@ import pro.gravit.launcher.hasher.HashedDir; import pro.gravit.launcher.hasher.HashedEntry; import pro.gravit.launcher.hasher.HashedFile; -import pro.gravit.launcher.managers.SettingsManager; import pro.gravit.launcher.request.update.UpdateRequest; -import pro.gravit.utils.helper.IOHelper; import pro.gravit.utils.helper.LogHelper; import java.io.File; import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.concurrent.atomic.AtomicReference; + @Deprecated public class LauncherUpdateController { diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/modules/impl/SimpleModuleManager.java b/LauncherAPI/src/main/java/pro/gravit/launcher/modules/impl/SimpleModuleManager.java index af9c68a8..6474c673 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/modules/impl/SimpleModuleManager.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/modules/impl/SimpleModuleManager.java @@ -5,7 +5,6 @@ import pro.gravit.utils.PublicURLClassLoader; import pro.gravit.utils.Version; import pro.gravit.utils.helper.IOHelper; -import pro.gravit.utils.helper.JVMHelper; import pro.gravit.utils.helper.LogHelper; import pro.gravit.launcher.LauncherTrustManager; diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/request/Request.java b/LauncherAPI/src/main/java/pro/gravit/launcher/request/Request.java index ecd9b17b..b941429a 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/request/Request.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/request/Request.java @@ -46,7 +46,6 @@ public R request(StdWebSocketService service) throws Exception { return requestDo(service); } - @SuppressWarnings("unchecked") protected R requestDo(StdWebSocketService service) throws Exception { return service.requestSync(this); } diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/ClientWebSocketService.java b/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/ClientWebSocketService.java index 45cac23c..5b896a35 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/ClientWebSocketService.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/ClientWebSocketService.java @@ -20,7 +20,6 @@ import java.lang.reflect.Type; import java.net.URI; import java.net.URISyntaxException; -import java.util.HashSet; public abstract class ClientWebSocketService extends ClientJSONPoint { public final Gson gson; diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/StdWebSocketService.java b/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/StdWebSocketService.java index 21ba495d..dfb5eecf 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/StdWebSocketService.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/request/websockets/StdWebSocketService.java @@ -18,7 +18,8 @@ import java.util.concurrent.ExecutionException; public class StdWebSocketService extends ClientWebSocketService { - private final ConcurrentHashMap futureMap = new ConcurrentHashMap<>(); + @SuppressWarnings("rawtypes") + private final ConcurrentHashMap futureMap = new ConcurrentHashMap<>(); private final HashSet eventHandlers = new HashSet<>(); public void registerEventHandler(EventHandler handler) { @@ -50,7 +51,8 @@ public void eventHandle(T webSocketEvent) { processEventHandlers(webSocketEvent); return; } - CompletableFuture future = futureMap.get(event.requestUUID); + @SuppressWarnings("rawtypes") + CompletableFuture future = futureMap.get(event.requestUUID); if(future != null) { if (event instanceof ErrorRequestEvent) { future.completeExceptionally(new RequestException(((ErrorRequestEvent) event).error)); diff --git a/LauncherCore/src/main/java/pro/gravit/launcher/AsyncDownloader.java b/LauncherCore/src/main/java/pro/gravit/launcher/AsyncDownloader.java index a9707b2c..4a024f88 100644 --- a/LauncherCore/src/main/java/pro/gravit/launcher/AsyncDownloader.java +++ b/LauncherCore/src/main/java/pro/gravit/launcher/AsyncDownloader.java @@ -17,12 +17,13 @@ import java.util.concurrent.Executor; public class AsyncDownloader { + public static final Callback IGNORE = (ignored) -> {}; public AsyncDownloader(Callback callback) { this.callback = callback; } public AsyncDownloader() { - callback = (ignored) -> {}; + callback = IGNORE; } @FunctionalInterface @@ -33,11 +34,18 @@ public interface Callback public final Callback callback; public static class SizedFile { - public final String path; + public final String urlPath, filePath; public final long size; public SizedFile(String path, long size) { - this.path = path; + this.urlPath = path; + this.filePath = path; + this.size = size; + } + + public SizedFile(String urlPath, String filePath, long size) { + this.urlPath = urlPath; + this.filePath = filePath; this.size = size; } } @@ -67,8 +75,8 @@ public void downloadListInOneThread(List files, String baseURL, Path String path = baseUri.getPath(); for(AsyncDownloader.SizedFile currentFile : files) { - URL url = new URI(scheme,host,path + currentFile.path, "", "").toURL(); - downloadFile(url, targetDir.resolve(currentFile.path), currentFile.size); + URL url = new URI(scheme, host, path + currentFile.urlPath, "", "").toURL(); + downloadFile(url, targetDir.resolve(currentFile.filePath), currentFile.size); } } public List> sortFiles(List files, int threads) @@ -90,7 +98,8 @@ public List> sortFiles(List files, int threads) return result; } - public CompletableFuture[] runDownloadList(List> files, String baseURL, Path targetDir, Executor executor) { + @SuppressWarnings("rawtypes") + public CompletableFuture[] runDownloadList(List> files, String baseURL, Path targetDir, Executor executor) { int threads = files.size(); CompletableFuture[] futures = new CompletableFuture[threads]; for(int i=0;i