[FIX] Критические фиксы

This commit is contained in:
Gravit 2020-03-22 08:30:29 +07:00
parent c7468eba14
commit fbfb074e0a
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
5 changed files with 14 additions and 14 deletions

View file

@ -29,7 +29,7 @@ public void execute(ChannelHandlerContext ctx, Client client) {
for (ClientProfile p : profiles) {
if (p.getTitle().equals(this.client)) {
if (server.config.protectHandler instanceof ProfilesProtectHandler &&
((ProfilesProtectHandler) server.config.protectHandler).canChangeProfile(p, client)) {
!((ProfilesProtectHandler) server.config.protectHandler).canChangeProfile(p, client)) {
sendError("Access denied");
return;
}

View file

@ -21,7 +21,7 @@ public String getType() {
@Override
public void execute(ChannelHandlerContext ctx, Client client) {
if (server.config.protectHandler instanceof ProfilesProtectHandler && ((ProfilesProtectHandler) server.config.protectHandler).canGetUpdates(dirName, client)) {
if (server.config.protectHandler instanceof ProfilesProtectHandler && !((ProfilesProtectHandler) server.config.protectHandler).canGetUpdates(dirName, client)) {
sendError("Access denied");
return;
}

View file

@ -40,7 +40,7 @@
import java.util.stream.Stream;
public class ClientLauncherEntryPoint {
private ClientLauncherProcess.ClientParams readParams(SocketAddress address) throws IOException {
private static ClientLauncherProcess.ClientParams readParams(SocketAddress address) throws IOException {
try (Socket socket = IOHelper.newSocket())
{
socket.connect(address);
@ -56,7 +56,7 @@ private ClientLauncherProcess.ClientParams readParams(SocketAddress address) thr
}
}
private static ClientClassLoader classLoader;
public void main(String[] args) throws Throwable {
public static void main(String[] args) throws Throwable {
LauncherEngine.IS_CLIENT.set(true);
LauncherEngine engine = LauncherEngine.clientInstance();
LauncherEngine.checkClass(LauncherEngine.class);
@ -68,9 +68,9 @@ public void main(String[] args) throws Throwable {
initGson(LauncherEngine.modulesManager);
LauncherEngine.verifyNoAgent();
LauncherEngine.modulesManager.invokeEvent(new PreConfigPhase());
JVMHelper.verifySystemProperties(ClientLauncher.class, true);
JVMHelper.verifySystemProperties(ClientLauncherEntryPoint.class, true);
EnvHelper.checkDangerousParams();
JVMHelper.checkStackTrace(ClientLauncher.class);
JVMHelper.checkStackTrace(ClientLauncherEntryPoint.class);
LogHelper.printVersion("Client Launcher");
engine.readKeys();
LauncherGuardManager.initGuard(true);

View file

@ -8,10 +8,7 @@
import pro.gravit.launcher.request.Request;
import pro.gravit.launcher.serialize.HOutput;
import pro.gravit.utils.Version;
import pro.gravit.utils.helper.EnvHelper;
import pro.gravit.utils.helper.IOHelper;
import pro.gravit.utils.helper.JVMHelper;
import pro.gravit.utils.helper.SecurityHelper;
import pro.gravit.utils.helper.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@ -26,7 +23,7 @@
public class ClientLauncherProcess {
private transient Process process;
private final transient Boolean[] waitWriteParams = new Boolean[1];
private final transient Boolean[] waitWriteParams = new Boolean[] {false};
public final Path executeFile;
public final Path workDir;
public final Path javaDir;
@ -136,8 +133,8 @@ public void addClientLegacyArgs(Collection<String> args) {
// Add args for tweaker
Collections.addAll(args, "--version", profile.getVersion().name);
Collections.addAll(args, "--gameDir", clientDir.toString());
Collections.addAll(args, "--assetsDir", assetDir.toString());
Collections.addAll(args, "--gameDir", clientDir);
Collections.addAll(args, "--assetsDir", assetDir);
}
private void addModernClientArgs(Collection<String> args) {
@ -201,6 +198,7 @@ public void start(boolean pipeOutput) throws IOException, InterruptedException {
processArgs.add("-cp");
//ADD CLASSPATH
processArgs.add(String.join(getPathSeparator(), systemClassPath));
processArgs.add(mainClass);
processArgs.addAll(systemClientArgs);
synchronized (waitWriteParams)
{
@ -209,6 +207,8 @@ public void start(boolean pipeOutput) throws IOException, InterruptedException {
waitWriteParams.wait(1000);
}
}
if(LogHelper.isDebugEnabled())
LogHelper.debug("Commandline: %s", Arrays.toString(processArgs.toArray()));
ProcessBuilder processBuilder = new ProcessBuilder(processArgs);
EnvHelper.addEnv(processBuilder);
processBuilder.environment().putAll(systemEnv);

View file

@ -157,7 +157,7 @@ public String[] getClassPath() {
}
public String[] getAlternativeClassPath() {
return classPath.toArray(new String[0]);
return altClassPath.toArray(new String[0]);
}