com/hypixel/hytale/LateMain.java
package com.hypixel.hytale;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.logger.backend.HytaleFileHandler;
import com.hypixel.hytale.logger.backend.HytaleLoggerBackend;
import com.hypixel.hytale.logger.sentry.SkipSentryException;
import com.hypixel.hytale.server.core.HytaleServer;
import com.hypixel.hytale.server.core.HytaleServerConfig;
import com.hypixel.hytale.server.core.Options;
import io.sentry.Sentry;
import java.util.Map;
import java.util.logging.Level;
public class LateMain {
public LateMain() {
}
public static void lateMain(String[] args) {
try {
if (!Options.parse(args)) {
HytaleLogger.init();
HytaleFileHandler.INSTANCE.enable();
HytaleLogger.replaceStd();
HytaleLoggerBackend.LOG_LEVEL_LOADER = (name) -> {
for(Map.Entry<String, Level> e : Options.getOptionSet().valuesOf(Options.LOG_LEVELS)) {
if (name.equals(e.getKey())) {
return (Level)e.getValue();
}
}
HytaleServer hytaleServer = HytaleServer.get();
if (hytaleServer != null) {
HytaleServerConfig config = hytaleServer.getConfig();
if (config != null) {
Level configLevel = (Level)config.getLogLevels().get(name);
if (configLevel != null) {
return configLevel;
}
}
}
if (Options.getOptionSet().has(Options.SHUTDOWN_AFTER_VALIDATE)) {
return Level.WARNING;
} else {
return null;
}
};
if (Options.getOptionSet().has(Options.SHUTDOWN_AFTER_VALIDATE)) {
HytaleLoggerBackend.reloadLogLevels();
}
new HytaleServer();
}
} catch (Throwable var2) {
if (!SkipSentryException.hasSkipSentry(var2)) {
Sentry.captureException(var2);
}
var2.printStackTrace();
throw new RuntimeException("Failed to create HytaleServer", var2);
}
}
}
com/hypixel/hytale/Main.java
package com.hypixel.hytale;
import com.hypixel.hytale.plugin.early.EarlyPluginLoader;
import com.hypixel.hytale.plugin.early.TransformingClassLoader;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.util.Locale;
import javax.annotation.Nonnull;
public final class Main {
public Main() {
}
public static void main(String[] args) {
Locale.setDefault(Locale.ENGLISH);
System.setProperty("java.awt.headless", "true");
System.setProperty("file.encoding", "UTF-8");
EarlyPluginLoader.loadEarlyPlugins(args);
if (EarlyPluginLoader.hasTransformers()) {
launchWithTransformingClassLoader(args);
} else {
LateMain.lateMain(args);
}
}
private static void launchWithTransformingClassLoader(@Nonnull String[] args) {
try {
URL[] urls = getClasspathUrls();
ClassLoader Main.class.getClassLoader();
(urls, EarlyPluginLoader.getTransformers(), appClassLoader.getParent(), appClassLoader);
Thread.currentThread().setContextClassLoader(transformingClassLoader);
Class<?> lateMainClass = transformingClassLoader.loadClass();
lateMainClass.getMethod(, String[].class);
mainMethod.invoke((Object), args);
} (NoSuchMethodException | IllegalAccessException | ClassNotFoundException e) {
(, e);
} (InvocationTargetException e) {
e.getCause();
(cause RuntimeException re) {
re;
} (cause Error err) {
err;
} {
(, cause);
}
}
}
URL[] getClasspathUrls() {
Main.class.getClassLoader();
(classLoader URLClassLoader urlClassLoader) {
urlClassLoader.getURLs();
} {
ObjectArrayList<URL> urls = <URL>();
System.getProperty();
(classpath != && !classpath.isEmpty()) {
(String pathStr : classpath.split(System.getProperty())) {
{
Path.of(pathStr);
(Files.exists(path, [])) {
urls.add(path.toUri().toURL());
}
} (Exception var8) {
System.err.println( + pathStr);
}
}
}
(URL[])urls.toArray((x$) -> [x$]);
}
}
}