mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-31 20:59:54 +03:00
[FIX] Фикс инициализации Guard и ClassCastException
This commit is contained in:
parent
988d220f35
commit
49e26d0d29
2 changed files with 11 additions and 2 deletions
|
@ -113,13 +113,13 @@ public void start(String... args) throws Throwable {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
LauncherGuardManager.initGuard(false);
|
|
||||||
if(UpdateRequest.getController() == null) UpdateRequest.setController(new LauncherUpdateController());
|
if(UpdateRequest.getController() == null) UpdateRequest.setController(new LauncherUpdateController());
|
||||||
Objects.requireNonNull(args, "args");
|
Objects.requireNonNull(args, "args");
|
||||||
if (started.getAndSet(true))
|
if (started.getAndSet(true))
|
||||||
throw new IllegalStateException("Launcher has been already started");
|
throw new IllegalStateException("Launcher has been already started");
|
||||||
LauncherEngine.modulesManager.invokeEvent(new ClientEngineInitPhase(this));
|
LauncherEngine.modulesManager.invokeEvent(new ClientEngineInitPhase(this));
|
||||||
runtimeProvider.preLoad();
|
runtimeProvider.preLoad();
|
||||||
|
LauncherGuardManager.initGuard(false);
|
||||||
FunctionalBridge.getHWID = CommonHelper.newThread("GetHWID Thread", true, FunctionalBridge::getHWID);
|
FunctionalBridge.getHWID = CommonHelper.newThread("GetHWID Thread", true, FunctionalBridge::getHWID);
|
||||||
FunctionalBridge.getHWID.start();
|
FunctionalBridge.getHWID.start();
|
||||||
LogHelper.debug("Dir: %s", DirBridge.dir);
|
LogHelper.debug("Dir: %s", DirBridge.dir);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
import javax.net.ssl.SSLException;
|
import javax.net.ssl.SSLException;
|
||||||
|
|
||||||
|
import pro.gravit.launcher.events.ExceptionEvent;
|
||||||
import pro.gravit.launcher.events.request.ErrorRequestEvent;
|
import pro.gravit.launcher.events.request.ErrorRequestEvent;
|
||||||
import pro.gravit.launcher.request.Request;
|
import pro.gravit.launcher.request.Request;
|
||||||
import pro.gravit.launcher.request.RequestException;
|
import pro.gravit.launcher.request.RequestException;
|
||||||
|
@ -67,6 +68,10 @@ public WebSocketEvent get() throws InterruptedException, ExecutionException {
|
||||||
ErrorRequestEvent errorRequestEvent = (ErrorRequestEvent) event.result;
|
ErrorRequestEvent errorRequestEvent = (ErrorRequestEvent) event.result;
|
||||||
throw new ExecutionException(new RequestException(errorRequestEvent.error));
|
throw new ExecutionException(new RequestException(errorRequestEvent.error));
|
||||||
}
|
}
|
||||||
|
if (event.result.getType().equals("exception")) {
|
||||||
|
ExceptionEvent error = (ExceptionEvent) event.result;
|
||||||
|
throw new ExecutionException(new RequestException(String.format("LaunchServer fatal error: %s: %s", error.clazz, error.message)));
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,10 +85,14 @@ public WebSocketEvent get(long timeout, TimeUnit unit) throws InterruptedExcepti
|
||||||
}
|
}
|
||||||
WebSocketEvent result = event.result;
|
WebSocketEvent result = event.result;
|
||||||
waitEventHandler.requests.remove(event);
|
waitEventHandler.requests.remove(event);
|
||||||
if (event.result.getType().equals("error") || event.result.getType().equals("exception")) {
|
if (event.result.getType().equals("error")) {
|
||||||
ErrorRequestEvent errorRequestEvent = (ErrorRequestEvent) event.result;
|
ErrorRequestEvent errorRequestEvent = (ErrorRequestEvent) event.result;
|
||||||
throw new ExecutionException(new RequestException(errorRequestEvent.error));
|
throw new ExecutionException(new RequestException(errorRequestEvent.error));
|
||||||
}
|
}
|
||||||
|
if (event.result.getType().equals("exception")) {
|
||||||
|
ExceptionEvent error = (ExceptionEvent) event.result;
|
||||||
|
throw new ExecutionException(new RequestException(String.format("LaunchServer fatal error: %s: %s", error.clazz, error.message)));
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue