Index: bootstrap/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- bootstrap/pom.xml (revision 53cc3242e1d2786c34b2e138d233c4eeca8e3b1d) +++ bootstrap/pom.xml (revision ) @@ -57,7 +57,8 @@ <configuration> <archive> <manifestEntries> - <Main-Class>net.md_5.bungee.Bootstrap</Main-Class> + <Main-Class>net.md_5.bungee.Bootstrap</Main-Class> + <Class-Path>Launcher.jar</Class-Path> <Implementation-Version>${describe}</Implementation-Version> <Specification-Version>${maven.build.timestamp}</Specification-Version> </manifestEntries> Index: proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java (revision 53cc3242e1d2786c34b2e138d233c4eeca8e3b1d) +++ proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java (revision ) @@ -8,10 +8,13 @@ import java.net.URLEncoder; import java.security.MessageDigest; import java.util.List; +import java.util.Map; import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.logging.Level; import javax.crypto.SecretKey; + +import com.mojang.authlib.yggdrasil.LegacyBridge; import lombok.Getter; import lombok.RequiredArgsConstructor; import net.md_5.bungee.BungeeCord; @@ -261,7 +264,7 @@ this.handshake = handshake; ch.setVersion( handshake.getProtocolVersion() ); - // Starting with FML 1.8, a "\0FML\0" token is appended to the handshake. This interferes + // Starting with FML 1.8, a "\0FML\0" token is appended to the handshake. This interferes // with Bungee's IP forwarding, so we detect it, and remove it from the host string, for now. // We know FML appends \00FML\00. However, we need to also consider that other systems might // add their own data to the end of the string. So, we just take everything from the \0 character @@ -402,35 +405,26 @@ { sha.update( bit ); } - String encodedHash = URLEncoder.encode( new BigInteger( sha.digest() ).toString( 16 ), "UTF-8" ); - String authURL = "https://sessionserver.mojang.com/session/minecraft/hasJoined?username=" + encName + "&serverId=" + encodedHash; - - Callback<String> handler = new Callback<String>() - { - @Override - public void done(String result, Throwable error) - { - if ( error == null ) - { - LoginResult obj = BungeeCord.getInstance().gson.fromJson( result, LoginResult.class ); - if ( obj != null ) - { - loginProfile = obj; - uniqueId = Util.getUUID( obj.getId() ); - finish(); - return; - } - disconnect( bungee.getTranslation( "offline_mode_player" ) ); - } else - { - disconnect( bungee.getTranslation( "mojang_fail" ) ); - bungee.getLogger().log( Level.SEVERE, "Error authenticating " + getName() + " with minecraft.net", error ); + final String username = InitialHandler.this.getName(); + final String serverID = new BigInteger(sha.digest()).toString(16); + ch.getHandle().eventLoop().execute(() -> { + try { + Map<String, String> properties = LegacyBridge.checkServerWithProperties(username, serverID); + if(properties == null) { // Invalid username or serverID + disconnect("Bad Login (Serverside)"); + return; } - } - }; - HttpClient.get( authURL, ch.getHandle().eventLoop(), handler ); + // Successful login + uniqueId = UUID.fromString(properties.remove("uuid")); + loginProfile = new LoginResult(properties); + finish(); + } catch(Exception e) { + disconnect("Authentication failed"); + bungee.getLogger().log(Level.SEVERE, "Error authenticating " + username + " with Launcher", e); + } + }); } private void finish() Index: bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java (revision 53cc3242e1d2786c34b2e138d233c4eeca8e3b1d) +++ bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java (revision ) @@ -5,9 +5,9 @@ public static void main(String[] args) throws Exception { - if ( Float.parseFloat( System.getProperty( "java.class.version" ) ) < 51.0 ) + if ( Float.parseFloat( System.getProperty( "java.class.version" ) ) < 52.0 ) { - System.err.println( "*** ERROR *** BungeeCord requires Java 7 or above to function! Please download and install it!" ); + System.err.println( "*** ERROR *** BungeeCord requires Java 8 or above to function! Please download and install it!" ); System.out.println( "You can check your Java version with the command: java -version" ); return; } Index: proxy/src/main/java/net/md_5/bungee/connection/LoginResult.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- proxy/src/main/java/net/md_5/bungee/connection/LoginResult.java (revision 53cc3242e1d2786c34b2e138d233c4eeca8e3b1d) +++ proxy/src/main/java/net/md_5/bungee/connection/LoginResult.java (revision ) @@ -1,5 +1,8 @@ package net.md_5.bungee.connection; +import java.util.Map; +import java.util.Map.Entry; + import lombok.AllArgsConstructor; import lombok.Data; @@ -11,6 +14,17 @@ private String id; private Property[] properties; + public LoginResult(Map<String, String> propertiesMap) { + id = propertiesMap.remove("uuid-hash"); + properties = new Property[propertiesMap.size()]; + + int i = 0; + for (Entry<String, String> entry : propertiesMap.entrySet()) { + properties[i] = new Property(entry.getKey(), entry.getValue(), ""); + i++; + } + } + @Data @AllArgsConstructor public static class Property Index: pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- pom.xml (revision 53cc3242e1d2786c34b2e138d233c4eeca8e3b1d) +++ pom.xml (revision ) @@ -67,8 +67,8 @@ <properties> <build.number>unknown</build.number> <netty.version>4.1.9.Final</netty.version> - <maven.compiler.source>1.7</maven.compiler.source> - <maven.compiler.target>1.7</maven.compiler.target> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> @@ -97,6 +97,13 @@ <version>1.16.12</version> <scope>provided</scope> </dependency> + <dependency> + <groupId>launcher</groupId> + <artifactId>clientside</artifactId> + <version>13.4+</version> + <scope>system</scope> + <systemPath>/full/path/to/Launcher.jar</systemPath> + </dependency> </dependencies> <build> @@ -116,31 +123,6 @@ </goals> </execution> </executions> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>animal-sniffer-maven-plugin</artifactId> - <version>1.13</version> - <executions> - <execution> - <phase>process-classes</phase> - <goals> - <goal>check</goal> - </goals> - </execution> - </executions> - <configuration> - <ignores> - <ignore>java.lang.ClassLoader</ignore> - <ignore>java.lang.Throwable</ignore> - <ignore>java.util.Locale</ignore> - </ignores> - <signature> - <groupId>org.codehaus.mojo.signature</groupId> - <artifactId>java16</artifactId> - <version>1.1</version> - </signature> - </configuration> </plugin> <!-- OSS Parent 9 uses 2.7, 2.10+ is broken anyway --> <plugin>