mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-31 20:59:54 +03:00
[ANY] Чистка кода x2
This commit is contained in:
parent
7d279da5af
commit
0524e77e3e
10 changed files with 73 additions and 64 deletions
|
@ -22,6 +22,7 @@
|
||||||
import cpw.mods.fml.SafeExitJVMLegacy;
|
import cpw.mods.fml.SafeExitJVMLegacy;
|
||||||
import net.minecraftforge.fml.SafeExitJVM;
|
import net.minecraftforge.fml.SafeExitJVM;
|
||||||
import pro.gravit.launcher.utils.NativeJVMHalt;
|
import pro.gravit.launcher.utils.NativeJVMHalt;
|
||||||
|
import pro.gravit.utils.helper.JVMHelper;
|
||||||
import pro.gravit.utils.helper.LogHelper;
|
import pro.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
|
@ -46,19 +47,20 @@ public static void premain(String agentArgument, Instrumentation instrumentation
|
||||||
NativeJVMHalt.class.getName();
|
NativeJVMHalt.class.getName();
|
||||||
NativeJVMHalt.initFunc();
|
NativeJVMHalt.initFunc();
|
||||||
isAgentStarted = true;
|
isAgentStarted = true;
|
||||||
boolean pb = true;
|
|
||||||
boolean rt = true;
|
|
||||||
if (agentArgument != null) {
|
|
||||||
String trimmedArg = agentArgument.trim();
|
|
||||||
if (!trimmedArg.isEmpty()) {
|
|
||||||
if (trimmedArg.contains("p")) pb = false;
|
|
||||||
if (trimmedArg.contains("r")) rt = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (System.getProperty("java.vm.name").toUpperCase(Locale.US).contains("HOTSPOT"))
|
if (System.getProperty("java.vm.name").toUpperCase(Locale.US).contains("HOTSPOT"))
|
||||||
try {
|
try {
|
||||||
if (ManagementFactory.getOperatingSystemMXBean().getName().startsWith("Windows")) replaceClasses(pb, rt);
|
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
|
||||||
else replaceClasses(false, false);
|
boolean pb = true;
|
||||||
|
boolean rt = true;
|
||||||
|
if (agentArgument != null) {
|
||||||
|
String trimmedArg = agentArgument.trim();
|
||||||
|
if (!trimmedArg.isEmpty()) {
|
||||||
|
if (trimmedArg.contains("p")) pb = false;
|
||||||
|
if (trimmedArg.contains("r")) rt = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
replaceClasses(pb, rt);
|
||||||
|
} else replaceClasses(false, false);
|
||||||
} catch (Error e) {
|
} catch (Error e) {
|
||||||
NativeJVMHalt.haltA(294);
|
NativeJVMHalt.haltA(294);
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -14,11 +14,15 @@
|
||||||
import java.nio.file.SimpleFileVisitor;
|
import java.nio.file.SimpleFileVisitor;
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.nio.file.attribute.PosixFilePermission;
|
import java.nio.file.attribute.PosixFilePermission;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
|
@ -55,16 +59,16 @@
|
||||||
|
|
||||||
public final class ClientLauncher {
|
public final class ClientLauncher {
|
||||||
private static final class ClassPathFileVisitor extends SimpleFileVisitor<Path> {
|
private static final class ClassPathFileVisitor extends SimpleFileVisitor<Path> {
|
||||||
private final Collection<Path> result;
|
private final Stream.Builder<Path> result;
|
||||||
|
|
||||||
private ClassPathFileVisitor(Collection<Path> result) {
|
private ClassPathFileVisitor(Stream.Builder<Path> result) {
|
||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||||
if (IOHelper.hasExtension(file, "jar") || IOHelper.hasExtension(file, "zip"))
|
if (IOHelper.hasExtension(file, "jar") || IOHelper.hasExtension(file, "zip"))
|
||||||
result.add(file);
|
result.accept(file);
|
||||||
return super.visitFile(file, attrs);
|
return super.visitFile(file, attrs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,10 +286,17 @@ private static void launch(ClientProfile profile, Params params) throws Throwabl
|
||||||
System.setProperty("minecraft.applet.TargetDirectory", params.clientDir.toString());
|
System.setProperty("minecraft.applet.TargetDirectory", params.clientDir.toString());
|
||||||
}
|
}
|
||||||
Collections.addAll(args, profile.getClientArgs());
|
Collections.addAll(args, profile.getClientArgs());
|
||||||
LogHelper.debug("Args: " + args);
|
List<String> copy = new ArrayList<>(args);
|
||||||
|
for (int i = 0, l = copy.size(); i < l; i++) {
|
||||||
|
String s = copy.get(i);
|
||||||
|
if ( i + 1 < l && ("--accessToken".equals(s) || "--session".equals(s))) {
|
||||||
|
copy.set(i + 1, "censored");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LogHelper.debug("Args: " + copy);
|
||||||
// Resolve main class and method
|
// Resolve main class and method
|
||||||
Class<?> mainClass = classLoader.loadClass(profile.getMainClass());
|
Class<?> mainClass = classLoader.loadClass(profile.getMainClass());
|
||||||
MethodHandle mainMethod = MethodHandles.publicLookup().findStatic(mainClass, "main", MethodType.methodType(void.class, String[].class)).asFixedArity();
|
MethodHandle mainMethod = MethodHandles.publicLookup().findStatic(mainClass, "main", MethodType.methodType(void.class, String[].class));
|
||||||
Launcher.LAUNCHED.set(true);
|
Launcher.LAUNCHED.set(true);
|
||||||
JVMHelper.fullGC();
|
JVMHelper.fullGC();
|
||||||
// Invoke main method
|
// Invoke main method
|
||||||
|
@ -407,7 +418,7 @@ public static Process launch(
|
||||||
Thread.sleep(200);
|
Thread.sleep(200);
|
||||||
}
|
}
|
||||||
if (!clientStarted) {
|
if (!clientStarted) {
|
||||||
LogHelper.error("Write Client Params not successful. Using debug mode for more information");
|
LogHelper.error("Client did not start properly. Enable debug mode for more information");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clientStarted = false;
|
clientStarted = false;
|
||||||
|
@ -515,29 +526,24 @@ public static void main(String... args) throws Throwable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static URL[] resolveClassPath(Path clientDir, String... classPath) throws IOException {
|
private static URL[] resolveClassPath(Path clientDir, String... classPath) throws IOException {
|
||||||
Collection<Path> result = new LinkedList<>();
|
return resolveClassPathStream(clientDir, classPath).map(IOHelper::toURL).toArray(URL[]::new);
|
||||||
for (String classPathEntry : classPath) {
|
|
||||||
Path path = clientDir.resolve(IOHelper.toPath(classPathEntry));
|
|
||||||
if (IOHelper.isDir(path)) { // Recursive walking and adding
|
|
||||||
IOHelper.walk(path, new ClassPathFileVisitor(result), false);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
result.add(path);
|
|
||||||
}
|
|
||||||
return result.stream().map(IOHelper::toURL).toArray(URL[]::new);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static LinkedList<Path> resolveClassPathList(Path clientDir, String... classPath) throws IOException {
|
private static LinkedList<Path> resolveClassPathList(Path clientDir, String... classPath) throws IOException {
|
||||||
LinkedList<Path> result = new LinkedList<>();
|
return resolveClassPathStream(clientDir, classPath).collect(Collectors.toCollection(LinkedList::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Stream<Path> resolveClassPathStream(Path clientDir, String... classPath) throws IOException {
|
||||||
|
Stream.Builder<Path> builder = Stream.builder();
|
||||||
for (String classPathEntry : classPath) {
|
for (String classPathEntry : classPath) {
|
||||||
Path path = clientDir.resolve(IOHelper.toPath(classPathEntry));
|
Path path = clientDir.resolve(IOHelper.toPath(classPathEntry));
|
||||||
if (IOHelper.isDir(path)) { // Recursive walking and adding
|
if (IOHelper.isDir(path)) { // Recursive walking and adding
|
||||||
IOHelper.walk(path, new ClassPathFileVisitor(result), false);
|
IOHelper.walk(path, new ClassPathFileVisitor(builder), false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result.add(path);
|
builder.accept(path);
|
||||||
}
|
}
|
||||||
return result;
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initGson() {
|
private static void initGson() {
|
||||||
|
|
|
@ -68,6 +68,7 @@ public String getHWDisk() {
|
||||||
|
|
||||||
public String getMacAddr() {
|
public String getMacAddr() {
|
||||||
for (NetworkIF networkIF : hardware.getNetworkIFs()) {
|
for (NetworkIF networkIF : hardware.getNetworkIFs()) {
|
||||||
|
if (networkIF.getNetworkInterface().isVirtual()) continue;
|
||||||
for (String ipv4 : networkIF.getIPv4addr()) {
|
for (String ipv4 : networkIF.getIPv4addr()) {
|
||||||
if (ipv4.startsWith("127.")) continue;
|
if (ipv4.startsWith("127.")) continue;
|
||||||
if (ipv4.startsWith("10.")) continue;
|
if (ipv4.startsWith("10.")) continue;
|
||||||
|
|
|
@ -27,15 +27,6 @@
|
||||||
|
|
||||||
public final class DirWatcher implements Runnable, AutoCloseable {
|
public final class DirWatcher implements Runnable, AutoCloseable {
|
||||||
private final class RegisterFileVisitor extends SimpleFileVisitor<Path> {
|
private final class RegisterFileVisitor extends SimpleFileVisitor<Path> {
|
||||||
private final Deque<String> path = new LinkedList<>();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
|
|
||||||
FileVisitResult result = super.postVisitDirectory(dir, exc);
|
|
||||||
if (!DirWatcher.this.dir.equals(dir))
|
|
||||||
path.removeLast();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
|
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
|
||||||
|
@ -46,7 +37,6 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) th
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maybe it's unnecessary to go deeper
|
// Maybe it's unnecessary to go deeper
|
||||||
path.add(IOHelper.getFileName(dir));
|
|
||||||
//if (matcher != null && !matcher.shouldVerify(path)) {
|
//if (matcher != null && !matcher.shouldVerify(path)) {
|
||||||
// return FileVisitResult.SKIP_SUBTREE;
|
// return FileVisitResult.SKIP_SUBTREE;
|
||||||
//}
|
//}
|
||||||
|
|
|
@ -60,7 +60,9 @@ public void download(String base, List<DownloadTask> applies, Path dstDirFile, D
|
||||||
URI u = new URI(scheme, host, path + apply.apply, "", "");
|
URI u = new URI(scheme, host, path + apply.apply, "", "");
|
||||||
callback.stateChanged(apply.apply, 0L, apply.size);
|
callback.stateChanged(apply.apply, 0L, apply.size);
|
||||||
Path targetPath = dstDirFile.resolve(apply.apply);
|
Path targetPath = dstDirFile.resolve(apply.apply);
|
||||||
LogHelper.debug("Download URL: %s to file %s dir: %s", u.toString(), targetPath.toAbsolutePath().toString(), dstDirFile.toAbsolutePath().toString());
|
if (LogHelper.isDebugEnabled()) {
|
||||||
|
LogHelper.debug("Download URL: %s to file %s dir: %s", u.toString(), targetPath.toAbsolutePath().toString(), dstDirFile.toAbsolutePath().toString());
|
||||||
|
}
|
||||||
if (get == null) get = new HttpGet(u);
|
if (get == null) get = new HttpGet(u);
|
||||||
else {
|
else {
|
||||||
get.reset();
|
get.reset();
|
||||||
|
@ -104,7 +106,9 @@ public void downloadOne(String url, Path target) throws IOException, URISyntaxEx
|
||||||
|
|
||||||
HttpGet get;
|
HttpGet get;
|
||||||
URI u = new URL(url).toURI();
|
URI u = new URL(url).toURI();
|
||||||
LogHelper.debug("Download URL: %s", u.toString());
|
if (LogHelper.isDebugEnabled()) {
|
||||||
|
LogHelper.debug("Download URL: %s", u.toString());
|
||||||
|
}
|
||||||
get = new HttpGet(u);
|
get = new HttpGet(u);
|
||||||
httpclient.execute(get, new FileDownloadResponseHandler(target.toAbsolutePath()));
|
httpclient.execute(get, new FileDownloadResponseHandler(target.toAbsolutePath()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,9 @@ public void findProfilesByNames(String[] usernames, Agent agent, ProfileLookupCa
|
||||||
try {
|
try {
|
||||||
sliceProfiles = new BatchProfileByUsernameRequest(sliceUsernames).request().playerProfiles;
|
sliceProfiles = new BatchProfileByUsernameRequest(sliceUsernames).request().playerProfiles;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
boolean debug = LogHelper.isDebugEnabled();
|
||||||
for (String username : sliceUsernames) {
|
for (String username : sliceUsernames) {
|
||||||
if (LogHelper.isDebugEnabled()) {
|
if (debug) {
|
||||||
LogHelper.debug("Couldn't find profile '%s': %s", username, e);
|
LogHelper.debug("Couldn't find profile '%s': %s", username, e);
|
||||||
}
|
}
|
||||||
callback.onProfileLookupFailed(new GameProfile((UUID) null, username), e);
|
callback.onProfileLookupFailed(new GameProfile((UUID) null, username), e);
|
||||||
|
@ -59,11 +60,13 @@ public void findProfilesByNames(String[] usernames, Agent agent, ProfileLookupCa
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request succeeded!
|
// Request succeeded!
|
||||||
for (int i = 0; i < sliceProfiles.length; i++) {
|
int len = sliceProfiles.length;
|
||||||
|
boolean debug = len > 0 && LogHelper.isDebugEnabled();
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
PlayerProfile pp = sliceProfiles[i];
|
PlayerProfile pp = sliceProfiles[i];
|
||||||
if (pp == null) {
|
if (pp == null) {
|
||||||
String username = sliceUsernames[i];
|
String username = sliceUsernames[i];
|
||||||
if (LogHelper.isDebugEnabled()) {
|
if (debug) {
|
||||||
LogHelper.debug("Couldn't find profile '%s'", username);
|
LogHelper.debug("Couldn't find profile '%s'", username);
|
||||||
}
|
}
|
||||||
callback.onProfileLookupFailed(new GameProfile((UUID) null, username), new ProfileNotFoundException("Server did not find the requested profile"));
|
callback.onProfileLookupFailed(new GameProfile((UUID) null, username), new ProfileNotFoundException("Server did not find the requested profile"));
|
||||||
|
@ -71,7 +74,7 @@ public void findProfilesByNames(String[] usernames, Agent agent, ProfileLookupCa
|
||||||
}
|
}
|
||||||
|
|
||||||
// Report as looked up
|
// Report as looked up
|
||||||
if (LogHelper.isDebugEnabled()) {
|
if (debug) {
|
||||||
LogHelper.debug("Successfully looked up profile '%s'", pp.username);
|
LogHelper.debug("Successfully looked up profile '%s'", pp.username);
|
||||||
}
|
}
|
||||||
callback.onProfileLookupSucceeded(YggdrasilMinecraftSessionService.toGameProfile(pp));
|
callback.onProfileLookupSucceeded(YggdrasilMinecraftSessionService.toGameProfile(pp));
|
||||||
|
|
|
@ -33,7 +33,8 @@ public final class YggdrasilMinecraftSessionService extends BaseMinecraftSession
|
||||||
public static final boolean NO_TEXTURES = Boolean.parseBoolean("launcher.com.mojang.authlib.noTextures");
|
public static final boolean NO_TEXTURES = Boolean.parseBoolean("launcher.com.mojang.authlib.noTextures");
|
||||||
|
|
||||||
public static void fillTextureProperties(GameProfile profile, PlayerProfile pp) {
|
public static void fillTextureProperties(GameProfile profile, PlayerProfile pp) {
|
||||||
if (LogHelper.isDebugEnabled()) {
|
boolean debug = LogHelper.isDebugEnabled();
|
||||||
|
if (debug) {
|
||||||
LogHelper.debug("fillTextureProperties, Username: '%s'", profile.getName());
|
LogHelper.debug("fillTextureProperties, Username: '%s'", profile.getName());
|
||||||
}
|
}
|
||||||
if (NO_TEXTURES)
|
if (NO_TEXTURES)
|
||||||
|
@ -44,14 +45,14 @@ public static void fillTextureProperties(GameProfile profile, PlayerProfile pp)
|
||||||
if (pp.skin != null) {
|
if (pp.skin != null) {
|
||||||
properties.put(Launcher.SKIN_URL_PROPERTY, new Property(Launcher.SKIN_URL_PROPERTY, pp.skin.url, ""));
|
properties.put(Launcher.SKIN_URL_PROPERTY, new Property(Launcher.SKIN_URL_PROPERTY, pp.skin.url, ""));
|
||||||
properties.put(Launcher.SKIN_DIGEST_PROPERTY, new Property(Launcher.SKIN_DIGEST_PROPERTY, SecurityHelper.toHex(pp.skin.digest), ""));
|
properties.put(Launcher.SKIN_DIGEST_PROPERTY, new Property(Launcher.SKIN_DIGEST_PROPERTY, SecurityHelper.toHex(pp.skin.digest), ""));
|
||||||
if (LogHelper.isDebugEnabled()) {
|
if (debug) {
|
||||||
LogHelper.debug("fillTextureProperties, Has skin texture for username '%s'", profile.getName());
|
LogHelper.debug("fillTextureProperties, Has skin texture for username '%s'", profile.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pp.cloak != null) {
|
if (pp.cloak != null) {
|
||||||
properties.put(Launcher.CLOAK_URL_PROPERTY, new Property(Launcher.CLOAK_URL_PROPERTY, pp.cloak.url, ""));
|
properties.put(Launcher.CLOAK_URL_PROPERTY, new Property(Launcher.CLOAK_URL_PROPERTY, pp.cloak.url, ""));
|
||||||
properties.put(Launcher.CLOAK_DIGEST_PROPERTY, new Property(Launcher.CLOAK_DIGEST_PROPERTY, SecurityHelper.toHex(pp.cloak.digest), ""));
|
properties.put(Launcher.CLOAK_DIGEST_PROPERTY, new Property(Launcher.CLOAK_DIGEST_PROPERTY, SecurityHelper.toHex(pp.cloak.digest), ""));
|
||||||
if (LogHelper.isDebugEnabled()) {
|
if (debug) {
|
||||||
LogHelper.debug("fillTextureProperties, Has cloak texture for username '%s'", profile.getName());
|
LogHelper.debug("fillTextureProperties, Has cloak texture for username '%s'", profile.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +99,8 @@ public YggdrasilMinecraftSessionService(AuthenticationService service) {
|
||||||
public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) {
|
public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) {
|
||||||
// Verify has UUID
|
// Verify has UUID
|
||||||
UUID uuid = profile.getUUID();
|
UUID uuid = profile.getUUID();
|
||||||
if (LogHelper.isDebugEnabled()) {
|
boolean debug = LogHelper.isDebugEnabled();
|
||||||
|
if (debug) {
|
||||||
LogHelper.debug("fillProfileProperties, UUID: %s", uuid);
|
LogHelper.debug("fillProfileProperties, UUID: %s", uuid);
|
||||||
}
|
}
|
||||||
if (uuid == null)
|
if (uuid == null)
|
||||||
|
@ -109,7 +111,7 @@ public GameProfile fillProfileProperties(GameProfile profile, boolean requireSec
|
||||||
try {
|
try {
|
||||||
pp = new ProfileByUUIDRequest(uuid).request().playerProfile;
|
pp = new ProfileByUUIDRequest(uuid).request().playerProfile;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (LogHelper.isDebugEnabled()) {
|
if (debug) {
|
||||||
LogHelper.debug("Couldn't fetch profile properties for '%s': %s", profile, e);
|
LogHelper.debug("Couldn't fetch profile properties for '%s': %s", profile, e);
|
||||||
}
|
}
|
||||||
return profile;
|
return profile;
|
||||||
|
@ -117,12 +119,14 @@ public GameProfile fillProfileProperties(GameProfile profile, boolean requireSec
|
||||||
|
|
||||||
// Verify is found
|
// Verify is found
|
||||||
if (pp == null) {
|
if (pp == null) {
|
||||||
LogHelper.debug("Couldn't fetch profile properties for '%s' as the profile does not exist", profile);
|
if (debug) {
|
||||||
|
LogHelper.debug("Couldn't fetch profile properties for '%s' as the profile does not exist", profile);
|
||||||
|
}
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new game profile from player profile
|
// Create new game profile from player profile
|
||||||
if (LogHelper.isDebugEnabled()) {
|
if (debug) {
|
||||||
LogHelper.debug("Successfully fetched profile properties for '%s'", profile);
|
LogHelper.debug("Successfully fetched profile properties for '%s'", profile);
|
||||||
}
|
}
|
||||||
fillTextureProperties(profile, pp);
|
fillTextureProperties(profile, pp);
|
||||||
|
|
|
@ -624,7 +624,11 @@ public static void setSocketFlags(Socket socket) throws SocketException {
|
||||||
|
|
||||||
// Set socket options
|
// Set socket options
|
||||||
socket.setSoTimeout(SOCKET_TIMEOUT);
|
socket.setSoTimeout(SOCKET_TIMEOUT);
|
||||||
socket.setTrafficClass(0b11100);
|
try {
|
||||||
|
socket.setTrafficClass(0b11100);
|
||||||
|
} catch (SocketException ignored) {
|
||||||
|
// Windows XP has no support for that
|
||||||
|
}
|
||||||
socket.setPerformancePreferences(1, 0, 2);
|
socket.setPerformancePreferences(1, 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,14 +345,9 @@ public static void subWarning(String format, Object... args) {
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public static String toString(Throwable exc) {
|
public static String toString(Throwable exc) {
|
||||||
try (StringWriter sw = new StringWriter()) {
|
StringWriter sw = new StringWriter();
|
||||||
try (PrintWriter pw = new PrintWriter(sw)) {
|
exc.printStackTrace(new PrintWriter(sw));
|
||||||
exc.printStackTrace(pw);
|
return sw.toString();
|
||||||
}
|
|
||||||
return sw.toString();
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new InternalError(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
|
|
|
@ -105,7 +105,7 @@ public void run(String... args) throws Throwable {
|
||||||
loadConfig();
|
loadConfig();
|
||||||
ServerWrapperSetup setup = new ServerWrapperSetup();
|
ServerWrapperSetup setup = new ServerWrapperSetup();
|
||||||
setup.run();
|
setup.run();
|
||||||
System.exit(0);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
modulesManager = new ModulesManager(wrapper);
|
modulesManager = new ModulesManager(wrapper);
|
||||||
modulesManager.autoload(modulesDir);
|
modulesManager.autoload(modulesDir);
|
||||||
|
|
Loading…
Reference in a new issue