diff --git a/LaunchServer/resources/launchserver/defaults/profile1.10.2.cfg b/LaunchServer/resources/launchserver/defaults/profile1.10.2.cfg index f3cfc90..65f8519 100644 --- a/LaunchServer/resources/launchserver/defaults/profile1.10.2.cfg +++ b/LaunchServer/resources/launchserver/defaults/profile1.10.2.cfg @@ -17,20 +17,27 @@ ]; updateVerify: [ "libraries", "natives", "mods", - "minecraft\\.jar", "forge\\.jar" + "minecraft\\.jar", "forge\\.jar", "liteloader\\.jar" ]; updateExclusions: []; # Client launcher params mainClass: "net.minecraft.launchwrapper.Launch"; -classPath: [ "forge.jar", "minecraft.jar", "libraries" ]; +classPath: [ "forge.jar", "liteloader.jar", "minecraft.jar", "libraries" ]; jvmArgs: [ "-Dfml.ignorePatchDiscrepancies=true", "-Dfml.ignoreInvalidMinecraftCertificates=true", + # Some options from Mojang's launcher + "-XX:+UseConcMarkSweepGC", + "-XX:+CMSIncrementalMode", + "-XX:-UseAdaptiveSizePolicy", + "-Xmn128M", + # JVM Attach protection "-XX:+DisableAttachMechanism" ]; clientArgs: [ - "--tweakClass", "net.minecraftforge.fml.common.launcher.FMLTweaker" + "--tweakClass", "net.minecraftforge.fml.common.launcher.FMLTweaker", + "--tweakClass", "com.mumfrey.liteloader.launch.LiteLoaderTweaker" ]; diff --git a/LaunchServer/resources/launchserver/defaults/profile1.11.cfg b/LaunchServer/resources/launchserver/defaults/profile1.11.cfg new file mode 100644 index 0000000..374e94d --- /dev/null +++ b/LaunchServer/resources/launchserver/defaults/profile1.11.cfg @@ -0,0 +1,43 @@ +version: "1.11"; +assetIndex: "1.11"; # 1.7.10+ only + +# Runtime-dependent params +dir: "XXXXX"; +assetDir: "asset1.11"; + +# Client params +sortIndex: 0; +title: "XXXXX"; +serverAddress: "server.tld"; +serverPort: 25565; + +# Updater and client watch service +update: [ + "servers\\.dat" +]; +updateVerify: [ + "libraries", "natives", "mods", + "minecraft\\.jar", "forge\\.jar", "liteloader\\.jar" +]; +updateExclusions: []; + +# Client launcher params +mainClass: "net.minecraft.launchwrapper.Launch"; +classPath: [ "forge.jar", "liteloader.jar", "minecraft.jar", "libraries" ]; +jvmArgs: [ + "-Dfml.ignorePatchDiscrepancies=true", + "-Dfml.ignoreInvalidMinecraftCertificates=true", + + # Some options from Mojang's launcher + "-XX:+UseConcMarkSweepGC", + "-XX:+CMSIncrementalMode", + "-XX:-UseAdaptiveSizePolicy", + "-Xmn128M", + + # JVM Attach protection + "-XX:+DisableAttachMechanism" +]; +clientArgs: [ + "--tweakClass", "net.minecraftforge.fml.common.launcher.FMLTweaker", + "--tweakClass", "com.mumfrey.liteloader.launch.LiteLoaderTweaker" +]; diff --git a/LaunchServer/resources/launchserver/defaults/profile1.6.4.cfg b/LaunchServer/resources/launchserver/defaults/profile1.6.4.cfg index 65aec49..e4da9fd 100644 --- a/LaunchServer/resources/launchserver/defaults/profile1.6.4.cfg +++ b/LaunchServer/resources/launchserver/defaults/profile1.6.4.cfg @@ -32,6 +32,12 @@ "-Dfml.ignorePatchDiscrepancies=true", "-Dfml.ignoreInvalidMinecraftCertificates=true", + # Some options from Mojang's launcher + "-XX:+UseConcMarkSweepGC", + "-XX:+CMSIncrementalMode", + "-XX:-UseAdaptiveSizePolicy", + "-Xmn128M", + # JVM Attach protection "-XX:+DisableAttachMechanism", diff --git a/LaunchServer/resources/launchserver/defaults/profile1.7.10.cfg b/LaunchServer/resources/launchserver/defaults/profile1.7.10.cfg index eaf0a6d..f7eabaa 100644 --- a/LaunchServer/resources/launchserver/defaults/profile1.7.10.cfg +++ b/LaunchServer/resources/launchserver/defaults/profile1.7.10.cfg @@ -32,7 +32,13 @@ "-Dfml.ignorePatchDiscrepancies=true", "-Dfml.ignoreInvalidMinecraftCertificates=true", - # Experimental + # Some options from Mojang's launcher + "-XX:+UseConcMarkSweepGC", + "-XX:+CMSIncrementalMode", + "-XX:-UseAdaptiveSizePolicy", + "-Xmn128M", + + # JVM Attach protection "-XX:+DisableAttachMechanism" ]; clientArgs: [ diff --git a/LaunchServer/resources/launchserver/defaults/profile1.7.2.cfg b/LaunchServer/resources/launchserver/defaults/profile1.7.2.cfg index e1789ac..d080f35 100644 --- a/LaunchServer/resources/launchserver/defaults/profile1.7.2.cfg +++ b/LaunchServer/resources/launchserver/defaults/profile1.7.2.cfg @@ -32,6 +32,12 @@ "-Dfml.ignorePatchDiscrepancies=true", "-Dfml.ignoreInvalidMinecraftCertificates=true", + # Some options from Mojang's launcher + "-XX:+UseConcMarkSweepGC", + "-XX:+CMSIncrementalMode", + "-XX:-UseAdaptiveSizePolicy", + "-Xmn128M", + # JVM Attach protection "-XX:+DisableAttachMechanism" ]; diff --git a/LaunchServer/resources/launchserver/defaults/profile1.8.9.cfg b/LaunchServer/resources/launchserver/defaults/profile1.8.9.cfg index 8d551c9..e55ad25 100644 --- a/LaunchServer/resources/launchserver/defaults/profile1.8.9.cfg +++ b/LaunchServer/resources/launchserver/defaults/profile1.8.9.cfg @@ -17,20 +17,27 @@ ]; updateVerify: [ "libraries", "natives", "mods", - "minecraft\\.jar", "forge\\.jar" + "minecraft\\.jar", "forge\\.jar", "liteloader\\.jar" ]; updateExclusions: []; # Client launcher params mainClass: "net.minecraft.launchwrapper.Launch"; -classPath: [ "forge.jar", "minecraft.jar", "libraries" ]; +classPath: [ "forge.jar", "liteloader.jar", "minecraft.jar", "libraries" ]; jvmArgs: [ "-Dfml.ignorePatchDiscrepancies=true", "-Dfml.ignoreInvalidMinecraftCertificates=true", + # Some options from Mojang's launcher + "-XX:+UseConcMarkSweepGC", + "-XX:+CMSIncrementalMode", + "-XX:-UseAdaptiveSizePolicy", + "-Xmn128M", + # JVM Attach protection "-XX:+DisableAttachMechanism" ]; clientArgs: [ - "--tweakClass", "net.minecraftforge.fml.common.launcher.FMLTweaker" + "--tweakClass", "net.minecraftforge.fml.common.launcher.FMLTweaker", + "--tweakClass", "com.mumfrey.liteloader.launch.LiteLoaderTweaker" ]; diff --git a/LaunchServer/resources/launchserver/defaults/profile1.9.4.cfg b/LaunchServer/resources/launchserver/defaults/profile1.9.4.cfg index 18bae5e..076efcc 100644 --- a/LaunchServer/resources/launchserver/defaults/profile1.9.4.cfg +++ b/LaunchServer/resources/launchserver/defaults/profile1.9.4.cfg @@ -17,20 +17,27 @@ ]; updateVerify: [ "libraries", "natives", "mods", - "minecraft\\.jar", "forge\\.jar" + "minecraft\\.jar", "forge\\.jar", "liteloader\\.jar" ]; updateExclusions: []; # Client launcher params mainClass: "net.minecraft.launchwrapper.Launch"; -classPath: [ "forge.jar", "minecraft.jar", "libraries" ]; +classPath: [ "forge.jar", "liteloader.jar", "minecraft.jar", "libraries" ]; jvmArgs: [ "-Dfml.ignorePatchDiscrepancies=true", "-Dfml.ignoreInvalidMinecraftCertificates=true", + # Some options from Mojang's launcher + "-XX:+UseConcMarkSweepGC", + "-XX:+CMSIncrementalMode", + "-XX:-UseAdaptiveSizePolicy", + "-Xmn128M", + # JVM Attach protection "-XX:+DisableAttachMechanism" ]; clientArgs: [ - "--tweakClass", "net.minecraftforge.fml.common.launcher.FMLTweaker" + "--tweakClass", "net.minecraftforge.fml.common.launcher.FMLTweaker", + "--tweakClass", "com.mumfrey.liteloader.launch.LiteLoaderTweaker" ]; diff --git a/LaunchServer/source/auth/MySQLSourceConfig.java b/LaunchServer/source/auth/MySQLSourceConfig.java index 8d18554..9de27da 100644 --- a/LaunchServer/source/auth/MySQLSourceConfig.java +++ b/LaunchServer/source/auth/MySQLSourceConfig.java @@ -16,14 +16,11 @@ public final class MySQLSourceConfig extends ConfigObject implements AutoCloseable { @LauncherAPI public static final int TIMEOUT = VerifyHelper.verifyInt( - Integer.parseUnsignedInt(System.getProperty("launcher.mysql.timeout", Integer.toString(5))), - VerifyHelper.POSITIVE, "launcher.mysql.timeout can't be <= 0"); + Integer.parseUnsignedInt(System.getProperty("launcher.mysql.idleTimeout", Integer.toString(5000))), + VerifyHelper.POSITIVE, "launcher.mysql.idleTimeout can't be <= 5000"); private static final int MAX_POOL_SIZE = VerifyHelper.verifyInt( - Integer.parseUnsignedInt(System.getProperty("launcher.mysql.maxPoolSize", Integer.toString(25))), + Integer.parseUnsignedInt(System.getProperty("launcher.mysql.maxPoolSize", Integer.toString(3))), VerifyHelper.POSITIVE, "launcher.mysql.maxPoolSize can't be <= 0"); - private static final int STMT_CACHE_SIZE = VerifyHelper.verifyInt( - Integer.parseUnsignedInt(System.getProperty("launcher.mysql.stmtCacheSize", Integer.toString(250))), - VerifyHelper.NOT_NEGATIVE, "launcher.mysql.stmtCacheSize can't be < 0"); // Instance private final String poolName; @@ -68,14 +65,20 @@ if (source == null) { // New data source MysqlDataSource mysqlSource = new MysqlDataSource(); mysqlSource.setUseUnicode(true); - mysqlSource.setCachePrepStmts(true); - // Set timeouts and cache - mysqlSource.setEnableQueryTimeouts(true); - mysqlSource.setLoginTimeout(TIMEOUT); - mysqlSource.setConnectTimeout(TIMEOUT * 1000); - mysqlSource.setPrepStmtCacheSize(STMT_CACHE_SIZE); + // Prep statements cache + mysqlSource.setPrepStmtCacheSize(250); mysqlSource.setPrepStmtCacheSqlLimit(2048); + mysqlSource.setCachePrepStmts(true); + mysqlSource.setUseServerPrepStmts(true); + + // General optimizations + mysqlSource.setCacheServerConfiguration(true); + mysqlSource.setUseLocalSessionState(true); + mysqlSource.setRewriteBatchedStatements(true); + mysqlSource.setMaintainTimeStats(false); + mysqlSource.setUseUnbufferedInput(false); + mysqlSource.setUseReadAheadInput(false); // Set credentials mysqlSource.setServerName(address); @@ -96,8 +99,9 @@ // Set pool settings hikariSource.setPoolName(poolName); + hikariSource.setMinimumIdle(0); hikariSource.setMaximumPoolSize(MAX_POOL_SIZE); - hikariSource.setValidationTimeout(TIMEOUT * 1000L); + hikariSource.setIdleTimeout(TIMEOUT * 1000L); // Replace source with hds source = hikariSource; diff --git a/Launcher/TODO.txt b/Launcher/TODO.txt index b5f4c32..661a875 100644 --- a/Launcher/TODO.txt +++ b/Launcher/TODO.txt @@ -1,3 +1 @@ -1) обновить форж и тд 1.10.2 -2) сделать 1.11 3) сделать 1.5.2 diff --git a/Launcher/source/Launcher.java b/Launcher/source/Launcher.java index 375b756..0e567e3 100644 --- a/Launcher/source/Launcher.java +++ b/Launcher/source/Launcher.java @@ -65,7 +65,6 @@ import launcher.serialize.config.TextConfigWriter; import launcher.serialize.config.entry.BlockConfigEntry; import launcher.serialize.config.entry.BooleanConfigEntry; -import launcher.serialize.config.entry.ConfigEntry; import launcher.serialize.config.entry.ConfigEntry.Type; import launcher.serialize.config.entry.IntegerConfigEntry; import launcher.serialize.config.entry.ListConfigEntry; @@ -79,7 +78,7 @@ private static final AtomicReference CONFIG = new AtomicReference<>(); // Version info - @LauncherAPI public static final String VERSION = "15.2.1"; + @LauncherAPI public static final String VERSION = "15.3"; @LauncherAPI public static final String BUILD = readBuildNumber(); @LauncherAPI public static final int PROTOCOL_MAGIC = 0x724724_16; diff --git a/Launcher/source/client/ClientLauncher.java b/Launcher/source/client/ClientLauncher.java index 86cc5f5..499f0c7 100644 --- a/Launcher/source/client/ClientLauncher.java +++ b/Launcher/source/client/ClientLauncher.java @@ -272,13 +272,21 @@ } } + private static void addClientLegacyArgs(Collection args, ClientProfile profile, Params params) { + // TODO + } + private static void launch(ClientProfile profile, Params params) throws Throwable { // Add natives path JVMHelper.addNativePath(params.clientDir.resolve(NATIVES_DIR)); // Add client args Collection args = new LinkedList<>(); - addClientArgs(args, profile, params); + if (profile.getVersion().compareTo(Version.MC152) > 0) { + addClientArgs(args, profile, params); + } else { + addClientLegacyArgs(args, profile, params); + } Collections.addAll(args, profile.getClientArgs()); // Add client classpath diff --git a/Launcher/source/client/ClientProfile.java b/Launcher/source/client/ClientProfile.java index 2e91351..7c18abf 100644 --- a/Launcher/source/client/ClientProfile.java +++ b/Launcher/source/client/ClientProfile.java @@ -189,7 +189,14 @@ @LauncherAPI public enum Version { - MC164("1.6.4", 78), MC172("1.7.2", 4), MC1710("1.7.10", 5), MC189("1.8.9", 47), MC194("1.9.4", 110), MC1102("1.10.2", 210); + MC152("1.5.2", 61), + MC164("1.6.4", 78), + MC172("1.7.2", 4), + MC1710("1.7.10", 5), + MC189("1.8.9", 47), + MC194("1.9.4", 110), + MC1102("1.10.2", 210), + MC111("1.11", 315); private static final Map VERSIONS; public final String name; public final int protocol; diff --git a/Launcher/source/helper/IOHelper.java b/Launcher/source/helper/IOHelper.java index d37ce7d..0243e71 100644 --- a/Launcher/source/helper/IOHelper.java +++ b/Launcher/source/helper/IOHelper.java @@ -67,7 +67,7 @@ Integer.parseUnsignedInt(System.getProperty("launcher.httpTimeout", Integer.toString(5000))), VerifyHelper.POSITIVE, "launcher.httpTimeout can't be <= 0"); @LauncherAPI public static final int BUFFER_SIZE = VerifyHelper.verifyInt( - Integer.parseUnsignedInt(System.getProperty("launcher.bufferSize", Integer.toString(4096))), + Integer.parseUnsignedInt(System.getProperty("launcher.bufferSize", Integer.toString(65536))), VerifyHelper.POSITIVE, "launcher.bufferSize can't be <= 0"); // Platform-dependent @@ -225,7 +225,7 @@ @LauncherAPI public static byte[] newBuffer() { - return new byte[4096]; + return new byte[BUFFER_SIZE]; } @LauncherAPI @@ -235,7 +235,7 @@ @LauncherAPI public static char[] newCharBuffer() { - return new char[4096]; + return new char[BUFFER_SIZE]; } @LauncherAPI diff --git a/LauncherAuthlib/source/yggdrasil/YggdrasilGameProfileRepository.java b/LauncherAuthlib/source/yggdrasil/YggdrasilGameProfileRepository.java index 163bb34..1232bad 100644 --- a/LauncherAuthlib/source/yggdrasil/YggdrasilGameProfileRepository.java +++ b/LauncherAuthlib/source/yggdrasil/YggdrasilGameProfileRepository.java @@ -28,8 +28,7 @@ public void findProfilesByNames(String[] usernames, Agent agent, ProfileLookupCallback callback) { int offset = 0; while (offset < usernames.length) { - String[] sliceUsernames = Arrays.copyOfRange(usernames, offset, - Math.min(offset + BatchProfileByUsernameRequest.MAX_BATCH_SIZE, usernames.length)); + String[] sliceUsernames = Arrays.copyOfRange(usernames, offset, Math.min(offset + BatchProfileByUsernameRequest.MAX_BATCH_SIZE, usernames.length)); offset += BatchProfileByUsernameRequest.MAX_BATCH_SIZE; // Batch Username-To-UUID request @@ -53,8 +52,7 @@ if (pp == null) { String username = sliceUsernames[i]; 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")); continue; } diff --git a/LauncherAuthlib/source/yggdrasil/YggdrasilMinecraftSessionService.java b/LauncherAuthlib/source/yggdrasil/YggdrasilMinecraftSessionService.java index 43f99fe..8342dc9 100644 --- a/LauncherAuthlib/source/yggdrasil/YggdrasilMinecraftSessionService.java +++ b/LauncherAuthlib/source/yggdrasil/YggdrasilMinecraftSessionService.java @@ -1,5 +1,6 @@ package com.mojang.authlib.yggdrasil; +import java.net.InetAddress; import java.util.EnumMap; import java.util.Iterator; import java.util.Map; @@ -61,8 +62,7 @@ @Override public Map getTextures(GameProfile profile, boolean requireSecure) { LogHelper.debug("getTextures, Username: '%s'", profile.getName()); - Map textures = - new EnumMap<>(Type.class); + Map textures = new EnumMap<>(Type.class); // Add skin URL to textures map Iterator skinURL = profile.getProperties().get(ClientLauncher.SKIN_URL_PROPERTY).iterator(); @@ -105,6 +105,11 @@ } @Override + public GameProfile hasJoinedServer(GameProfile profile, String serverID, InetAddress address) throws AuthenticationUnavailableException { + return hasJoinedServer(profile, serverID); + } + + @Override public void joinServer(GameProfile profile, String accessToken, String serverID) throws AuthenticationException { if (!ClientLauncher.isLaunched()) { throw new AuthenticationException("Bad Login (Cheater)"); @@ -112,8 +117,7 @@ // Join server String username = profile.getName(); - LogHelper.debug("joinServer, Username: '%s', Access token: %s, Server ID: %s", - username, accessToken, serverID); + LogHelper.debug("joinServer, Username: '%s', Access token: %s, Server ID: %s", username, accessToken, serverID); // Make joinServer request boolean success; @@ -132,16 +136,12 @@ public static void fillTextureProperties(GameProfile profile, PlayerProfile pp) { PropertyMap properties = profile.getProperties(); if (pp.skin != null) { - properties.put(ClientLauncher.SKIN_URL_PROPERTY, new Property( - ClientLauncher.SKIN_URL_PROPERTY, pp.skin.url, "")); - properties.put(ClientLauncher.SKIN_DIGEST_PROPERTY, new Property( - ClientLauncher.SKIN_DIGEST_PROPERTY, SecurityHelper.toHex(pp.skin.digest), "")); + properties.put(ClientLauncher.SKIN_URL_PROPERTY, new Property(ClientLauncher.SKIN_URL_PROPERTY, pp.skin.url, "")); + properties.put(ClientLauncher.SKIN_DIGEST_PROPERTY, new Property(ClientLauncher.SKIN_DIGEST_PROPERTY, SecurityHelper.toHex(pp.skin.digest), "")); } if (pp.cloak != null) { - properties.put(ClientLauncher.CLOAK_URL_PROPERTY, new Property( - ClientLauncher.CLOAK_URL_PROPERTY, pp.cloak.url, "")); - properties.put(ClientLauncher.CLOAK_DIGEST_PROPERTY, new Property( - ClientLauncher.CLOAK_DIGEST_PROPERTY, SecurityHelper.toHex(pp.cloak.digest), "")); + properties.put(ClientLauncher.CLOAK_URL_PROPERTY, new Property(ClientLauncher.CLOAK_URL_PROPERTY, pp.cloak.url, "")); + properties.put(ClientLauncher.CLOAK_DIGEST_PROPERTY, new Property(ClientLauncher.CLOAK_DIGEST_PROPERTY, SecurityHelper.toHex(pp.cloak.digest), "")); } } diff --git a/compat/authlib/MinecraftSessionService-combined.class b/compat/authlib/MinecraftSessionService-combined.class new file mode 100644 index 0000000..854101d --- /dev/null +++ b/compat/authlib/MinecraftSessionService-combined.class Binary files differ diff --git a/compat/authlib/README.md b/compat/authlib/README.md index fa2000d..5809d0a 100644 --- a/compat/authlib/README.md +++ b/compat/authlib/README.md @@ -8,3 +8,8 @@ Этот класс - результат слияния ASM'ом методов из Authlib 1.7.2 и Authlib 1.7.10+, в нём есть метод как для получения UUID старого образца (без чёрточек, например `d3730e7436794ba6-8ab2a24ac9e755d4`), так и нового образца (`d3730e74-3679-4ba6-8ab2-a24ac9e755d4`). Уже включён в `authlib-clean.jar` + +MinecraftSessionService-combined.class +-------------------------------------- +Этот класс - результат слияния ASM'ом методов из Authlib 1.10.2 и Authlib 1.11+, в нём есть метод как для авторизации +на сервере с учётом InetAddress, так и без него. Уже включён в `authlib-clean.jar` diff --git a/compat/authlib/authlib-clean.jar b/compat/authlib/authlib-clean.jar index d4896c3..4f5361a 100644 --- a/compat/authlib/authlib-clean.jar +++ b/compat/authlib/authlib-clean.jar Binary files differ