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 ) @@ -63,6 +63,9 @@ import net.md_5.bungee.protocol.packet.StatusResponse; import net.md_5.bungee.util.BoundedArrayList; +import launcher.client.PlayerProfile; +import launcher.request.auth.CheckServerRequest; + @RequiredArgsConstructor public class InitialHandler extends PacketHandler implements PendingConnection { @@ -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 { + PlayerProfile pp = new CheckServerRequest(username, serverID).request(); + if(pp == null) { // Invalid username or serverID + disconnect("Bad Login (Serverside)"); + return; } - } - }; - HttpClient.get( authURL, ch.getHandle().eventLoop(), handler ); + // Successful login + loginProfile = new LoginResult(pp); + uniqueId = pp.uuid; + 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 ) @@ -3,6 +3,17 @@ import lombok.AllArgsConstructor; import lombok.Data; +import java.net.URL; +import java.io.IOException; +import java.io.FileNotFoundException; +import java.net.UnknownHostException; +import java.util.List; +import java.util.ArrayList; +import launcher.client.PlayerProfile; +import launcher.client.ClientLauncher; +import launcher.helper.LogHelper; +import launcher.helper.SecurityHelper; + @Data @AllArgsConstructor public class LoginResult @@ -11,6 +22,20 @@ private String id; private Property[] properties; + public LoginResult(PlayerProfile pp) { + id = ClientLauncher.toHash(pp.uuid); + List<Property> properitesList = new ArrayList<>(4); + if(pp.skin != null) { + properitesList.add(new Property(ClientLauncher.SKIN_URL_PROPERTY, pp.skin.url, "")); + properitesList.add(new Property(ClientLauncher.SKIN_DIGEST_PROPERTY, SecurityHelper.toHex(pp.skin.digest), "")); + } + if(pp.cloak != null) { + properitesList.add(new Property(ClientLauncher.CLOAK_URL_PROPERTY, pp.cloak.url, "")); + properitesList.add(new Property(ClientLauncher.CLOAK_DIGEST_PROPERTY, SecurityHelper.toHex(pp.cloak.digest), "")); + } + properties = properitesList.toArray(new Property[properitesList.size()]); + } + @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>12.0+</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>