mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 17:11:39 +03:00
212 lines
9.3 KiB
Diff
212 lines
9.3 KiB
Diff
|
Index: bootstrap/pom.xml
|
||
|
IDEA additional info:
|
||
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||
|
<+>UTF-8
|
||
|
===================================================================
|
||
|
--- bootstrap/pom.xml (revision 4c84f37fd23dfd67e4fee5dfd7cb62d67791129f)
|
||
|
+++ bootstrap/pom.xml (revision )
|
||
|
@@ -50,7 +50,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 4c84f37fd23dfd67e4fee5dfd7cb62d67791129f)
|
||
|
+++ proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java (revision )
|
||
|
@@ -2,6 +2,7 @@
|
||
|
|
||
|
import com.google.common.base.Charsets;
|
||
|
import com.google.common.base.Preconditions;
|
||
|
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||
|
import com.google.gson.Gson;
|
||
|
import java.math.BigInteger;
|
||
|
import java.net.InetAddress;
|
||
|
@@ -10,9 +11,14 @@
|
||
|
import java.security.MessageDigest;
|
||
|
import java.util.List;
|
||
|
import java.util.UUID;
|
||
|
+import java.util.concurrent.ExecutorService;
|
||
|
+import java.util.concurrent.Executors;
|
||
|
import java.util.concurrent.TimeUnit;
|
||
|
import java.util.logging.Level;
|
||
|
import javax.crypto.SecretKey;
|
||
|
+
|
||
|
+import com.mojang.authlib.yggdrasil.CompatBridge;
|
||
|
+import com.mojang.authlib.yggdrasil.CompatProfile;
|
||
|
import lombok.Getter;
|
||
|
import lombok.RequiredArgsConstructor;
|
||
|
import net.md_5.bungee.BungeeCord;
|
||
|
@@ -103,6 +109,8 @@
|
||
|
private boolean legacy;
|
||
|
@Getter
|
||
|
private String extraDataInHandshake = "";
|
||
|
+ private ExecutorService loginExecutor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().
|
||
|
+ setNameFormat("Login Thread #%1$d").setDaemon(true).build());
|
||
|
|
||
|
@Override
|
||
|
public boolean shouldHandle(PacketWrapper packet) throws Exception
|
||
|
@@ -262,7 +270,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
|
||
|
@@ -403,37 +411,27 @@
|
||
|
{
|
||
|
sha.update( bit );
|
||
|
}
|
||
|
- String encodedHash = URLEncoder.encode( new BigInteger( sha.digest() ).toString( 16 ), "UTF-8" );
|
||
|
|
||
|
- String preventProxy = ( ( BungeeCord.getInstance().config.isPreventProxyConnections() ) ? "&ip=" + URLEncoder.encode( getAddress().getAddress().getHostAddress(), "UTF-8" ) : "" );
|
||
|
- String authURL = "https://sessionserver.mojang.com/session/minecraft/hasJoined?username=" + encName + "&serverId=" + encodedHash + preventProxy;
|
||
|
|
||
|
- 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 && obj.getId() != null )
|
||
|
- {
|
||
|
- loginProfile = obj;
|
||
|
- name = obj.getName();
|
||
|
- 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);
|
||
|
+ loginExecutor.submit(() -> {
|
||
|
+ try {
|
||
|
+ CompatProfile properties = CompatBridge.checkServer(username, serverID);
|
||
|
+ if(properties == null) { // Invalid username or serverID
|
||
|
+ disconnect("Bad Login (Serverside)");
|
||
|
+ return;
|
||
|
}
|
||
|
- }
|
||
|
- };
|
||
|
|
||
|
- HttpClient.get( authURL, ch.getHandle().eventLoop(), handler );
|
||
|
+ // Successful login
|
||
|
+ uniqueId = properties.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 4c84f37fd23dfd67e4fee5dfd7cb62d67791129f)
|
||
|
+++ 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 4c84f37fd23dfd67e4fee5dfd7cb62d67791129f)
|
||
|
+++ proxy/src/main/java/net/md_5/bungee/connection/LoginResult.java (revision )
|
||
|
@@ -1,5 +1,6 @@
|
||
|
package net.md_5.bungee.connection;
|
||
|
|
||
|
+import com.mojang.authlib.yggdrasil.CompatProfile;
|
||
|
import lombok.AllArgsConstructor;
|
||
|
import lombok.Data;
|
||
|
|
||
|
@@ -12,6 +13,25 @@
|
||
|
private String name;
|
||
|
private Property[] properties;
|
||
|
|
||
|
+ public LoginResult(CompatProfile profile) {
|
||
|
+ id = profile.uuidHash;
|
||
|
+ properties = new Property[profile.countProperties()];
|
||
|
+
|
||
|
+ int index = 0;
|
||
|
+ if (profile.skinURL != null) {
|
||
|
+ properties[index++] = new Property(CompatProfile.SKIN_URL_PROPERTY, profile.skinURL, "");
|
||
|
+ }
|
||
|
+ if (profile.skinDigest != null) {
|
||
|
+ properties[index++] = new Property(CompatProfile.SKIN_DIGEST_PROPERTY, profile.skinDigest, "");
|
||
|
+ }
|
||
|
+ if (profile.cloakURL != null) {
|
||
|
+ properties[index++] = new Property(CompatProfile.CLOAK_URL_PROPERTY, profile.cloakURL, "");
|
||
|
+ }
|
||
|
+ if (profile.cloakDigest != null) {
|
||
|
+ properties[index++] = new Property(CompatProfile.CLOAK_DIGEST_PROPERTY, profile.cloakDigest, "");
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
@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 4c84f37fd23dfd67e4fee5dfd7cb62d67791129f)
|
||
|
+++ pom.xml (revision )
|
||
|
@@ -68,8 +68,8 @@
|
||
|
<properties>
|
||
|
<build.number>unknown</build.number>
|
||
|
<netty.version>4.1.17.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 @@
|
||
|
<artifactId>lombok</artifactId>
|
||
|
<version>1.16.16</version>
|
||
|
<scope>provided</scope>
|
||
|
+ </dependency>
|
||
|
+ <dependency>
|
||
|
+ <groupId>launcher</groupId>
|
||
|
+ <artifactId>clientside</artifactId>
|
||
|
+ <version>15.4+</version>
|
||
|
+ <scope>system</scope>
|
||
|
+ <systemPath>C:/Users/Administrator/Files/Projects/Launcher15.2/Launcher.jar</systemPath>
|
||
|
</dependency>
|
||
|
</dependencies>
|
||
|
|