diff --git a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java index aeded6fd..7a31d0c6 100644 --- a/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/ru/gravit/launcher/client/ClientLauncher.java @@ -449,7 +449,6 @@ public static void main(String... args) throws Throwable { Launcher.modulesManager.initModules(); // Verify ClientLauncher sign and classpath LogHelper.debug("Verifying ClientLauncher sign and classpath"); - //Warning - experimental. LinkedList classPath = resolveClassPathList(params.clientDir, profile.getClassPath()); for (Path classpathURL : classPath) { LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString()); diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/CheckServerRequest.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/CheckServerRequest.java index 94c29a23..4521f814 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/CheckServerRequest.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/CheckServerRequest.java @@ -7,6 +7,9 @@ import ru.gravit.launcher.profiles.PlayerProfile; import ru.gravit.launcher.request.Request; import ru.gravit.launcher.request.RequestType; +import ru.gravit.launcher.request.ResultInterface; +import ru.gravit.launcher.request.websockets.LegacyRequestBridge; +import ru.gravit.launcher.request.websockets.RequestInterface; import ru.gravit.launcher.serialize.HInput; import ru.gravit.launcher.serialize.HOutput; import ru.gravit.launcher.serialize.SerializeLimits; @@ -15,7 +18,7 @@ import java.io.IOException; -public final class CheckServerRequest extends Request { +public final class CheckServerRequest extends Request implements RequestInterface { private final String username; private final String serverID; @@ -31,6 +34,12 @@ public CheckServerRequest(String username, String serverID) { this(null, username, serverID); } + @Override + public CheckServerRequestEvent requestWebSockets() throws Exception + { + return (CheckServerRequestEvent) LegacyRequestBridge.sendRequest(this); + } + @Override public Integer getLegacyType() { return RequestType.CHECK_SERVER.getNumber(); @@ -51,4 +60,9 @@ protected CheckServerRequestEvent requestDo(HInput input, HOutput output) throws readError(input); return input.readBoolean() ? new CheckServerRequestEvent(new PlayerProfile(input)) : null; } + + @Override + public String getType() { + return "checkServer"; + } } diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/JoinServerRequest.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/JoinServerRequest.java index 0ff36115..f1d2dc35 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/JoinServerRequest.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/auth/JoinServerRequest.java @@ -5,6 +5,8 @@ import ru.gravit.launcher.events.request.JoinServerRequestEvent; import ru.gravit.launcher.request.Request; import ru.gravit.launcher.request.RequestType; +import ru.gravit.launcher.request.websockets.LegacyRequestBridge; +import ru.gravit.launcher.request.websockets.RequestInterface; import ru.gravit.launcher.serialize.HInput; import ru.gravit.launcher.serialize.HOutput; import ru.gravit.launcher.serialize.SerializeLimits; @@ -13,7 +15,7 @@ import java.io.IOException; -public final class JoinServerRequest extends Request { +public final class JoinServerRequest extends Request implements RequestInterface { // Instance private final String username; @@ -28,6 +30,11 @@ public JoinServerRequest(LauncherConfig config, String username, String accessTo this.serverID = VerifyHelper.verifyServerID(serverID); } + @Override + public JoinServerRequestEvent requestWebSockets() throws IOException, InterruptedException { + return (JoinServerRequestEvent) LegacyRequestBridge.sendRequest(this); + } + @LauncherAPI public JoinServerRequest(String username, String accessToken, String serverID) { this(null, username, accessToken, serverID); @@ -50,4 +57,8 @@ protected JoinServerRequestEvent requestDo(HInput input, HOutput output) throws return new JoinServerRequestEvent(input.readBoolean()); } + @Override + public String getType() { + return "joinServer"; + } } diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java index ea1cfabf..3158e8f8 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/update/UpdateRequest.java @@ -206,8 +206,8 @@ public UpdateRequestEvent requestWebSockets() throws Exception { Launcher.profile.pushOptionalFile(e.hdir, !Launcher.profile.isUpdateFastCheck()); HashedDir.Diff diff = e.hdir.diff(localDir, matcher); final List adds = new ArrayList<>(); - diff.mismatch.map().entrySet().stream().filter(e1 -> e1.getValue().getType().equals(HashedEntry.Type.FILE)).forEach(a -> { - adds.add(a.getKey()); + diff.mismatch.walk(IOHelper.CROSS_SEPARATOR, (path, name, entry) -> { + if(entry.getType() == HashedEntry.Type.FILE) adds.add(path.replaceAll(" ","%20")); }); totalSize = diff.mismatch.size(); startTime = Instant.now(); diff --git a/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedDir.java b/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedDir.java index beec1595..86079f27 100644 --- a/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedDir.java +++ b/libLauncher/src/main/java/ru/gravit/launcher/hasher/HashedDir.java @@ -335,4 +335,36 @@ public void write(HOutput output) throws IOException { entry.write(output); } } + public void walk(CharSequence separator, WalkCallback callback) + { + String append = ""; + walk(append,separator, callback, true); + } + @FunctionalInterface + public interface WalkCallback + { + void walked(String path, String name, HashedEntry entry); + } + private void walk(String append, CharSequence separator, WalkCallback callback , boolean noSeparator) + { + for(Map.Entry entry : map.entrySet()) + { + HashedEntry e = entry.getValue(); + if(e.getType() == Type.FILE) + { + if(noSeparator) + callback.walked(append + entry.getKey(), entry.getKey(), e); + else + callback.walked(append + separator + entry.getKey(), entry.getKey(), e); + } + else + { + String newAppend; + if(noSeparator) newAppend = append + entry.getKey(); + else newAppend = append + separator + entry.getKey(); + callback.walked(newAppend, entry.getKey(), e); + ((HashedDir)e).walk(newAppend, separator, callback, false); + } + } + } }