Update to latest snapshot.
This commit is contained in:
parent
edc5b4dc91
commit
96acdb97fd
@ -36,4 +36,11 @@ public interface PendingConnection extends Connection
|
||||
* @return the accepting listener
|
||||
*/
|
||||
ListenerInfo getListener();
|
||||
|
||||
/**
|
||||
* Get this connection's UUID, if set.
|
||||
*
|
||||
* @return the UUID
|
||||
*/
|
||||
String getUUID();
|
||||
}
|
||||
|
@ -99,4 +99,11 @@ public interface ProxiedPlayer extends Connection, CommandSender
|
||||
* @param server the server to set
|
||||
*/
|
||||
void setReconnectServer(ServerInfo server);
|
||||
|
||||
/**
|
||||
* Get this connection's UUID, if set.
|
||||
*
|
||||
* @return the UUID
|
||||
*/
|
||||
String getUUID();
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ import net.md_5.bungee.protocol.skip.PacketReader;
|
||||
public class Vanilla implements Protocol
|
||||
{
|
||||
|
||||
public static final byte PROTOCOL_VERSION = 78;
|
||||
public static final String GAME_VERSION = "1.6.4";
|
||||
public static final byte PROTOCOL_VERSION = 80;
|
||||
public static final String GAME_VERSION = "13w39b";
|
||||
@Getter
|
||||
private static final Vanilla instance = new Vanilla();
|
||||
/*========================================================================*/
|
||||
@ -188,7 +188,7 @@ public class Vanilla implements Protocol
|
||||
};
|
||||
opCodes[0x14] = new OpCode[]
|
||||
{
|
||||
INT, STRING, INT, INT, INT, BYTE, BYTE, SHORT, METADATA
|
||||
INT, STRING, STRING, INT, INT, INT, BYTE, BYTE, SHORT, METADATA
|
||||
};
|
||||
opCodes[0x16] = new OpCode[]
|
||||
{
|
||||
@ -304,7 +304,7 @@ public class Vanilla implements Protocol
|
||||
};
|
||||
opCodes[0x3E] = new OpCode[]
|
||||
{
|
||||
STRING, INT, INT, INT, FLOAT, BYTE
|
||||
STRING, INT, INT, INT, FLOAT, BYTE, BYTE
|
||||
};
|
||||
opCodes[0x3F] = new OpCode[]
|
||||
{
|
||||
@ -312,7 +312,7 @@ public class Vanilla implements Protocol
|
||||
};
|
||||
opCodes[0x46] = new OpCode[]
|
||||
{
|
||||
BYTE, BYTE
|
||||
BYTE, FLOAT
|
||||
};
|
||||
opCodes[0x47] = new OpCode[]
|
||||
{
|
||||
@ -374,10 +374,6 @@ public class Vanilla implements Protocol
|
||||
{
|
||||
SHORT, SHORT, INT_BYTE
|
||||
};
|
||||
opCodes[0xC8] = new OpCode[]
|
||||
{
|
||||
INT, INT
|
||||
};
|
||||
opCodes[0xCA] = new OpCode[]
|
||||
{
|
||||
BYTE, FLOAT, FLOAT
|
||||
|
@ -27,6 +27,10 @@ public abstract class AbstractPacketHandler
|
||||
{
|
||||
}
|
||||
|
||||
public void handle(PacketC8Statistic statistic) throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
public void handle(PacketC9PlayerListItem playerList) throws Exception
|
||||
{
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
package net.md_5.bungee.protocol.packet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class PacketC8Statistic extends DefinedPacket
|
||||
{
|
||||
|
||||
public PacketC8Statistic()
|
||||
{
|
||||
super( 0xC8 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buf)
|
||||
{
|
||||
int len = buf.readInt();
|
||||
for ( int i = 0; i < len; i++ )
|
||||
{
|
||||
readString( buf );
|
||||
buf.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buf)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(AbstractPacketHandler handler) throws Exception
|
||||
{
|
||||
handler.handle( this );
|
||||
}
|
||||
}
|
@ -357,4 +357,10 @@ public final class UserConnection implements ProxiedPlayer
|
||||
{
|
||||
return unsafe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUUID()
|
||||
{
|
||||
return getPendingConnection().getUUID();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package net.md_5.bungee.connection;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import io.netty.util.concurrent.ScheduledFuture;
|
||||
import java.math.BigInteger;
|
||||
import java.net.InetSocketAddress;
|
||||
@ -86,6 +88,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
private ScheduledFuture<?> pingFuture;
|
||||
private InetSocketAddress vHost;
|
||||
private byte version = -1;
|
||||
@Getter
|
||||
private String UUID;
|
||||
|
||||
private enum State
|
||||
{
|
||||
@ -250,18 +254,9 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
if ( this.onlineMode )
|
||||
{
|
||||
String encName = URLEncoder.encode( InitialHandler.this.getName(), "UTF-8" );
|
||||
String encID = URLEncoder.encode( InitialHandler.this.request.getServerId(), "UTF-8" );
|
||||
|
||||
MessageDigest sha = MessageDigest.getInstance( "SHA-1" );
|
||||
for ( byte[] bit : new byte[][]
|
||||
{
|
||||
request.getServerId().getBytes( "ISO_8859_1" ), sharedKey.getEncoded(), EncryptionUtil.keys.getPublic().getEncoded()
|
||||
} )
|
||||
{
|
||||
sha.update( bit );
|
||||
}
|
||||
|
||||
String encodedHash = URLEncoder.encode( new BigInteger( sha.digest() ).toString( 16 ), "UTF-8" );
|
||||
String authURL = "http://session.minecraft.net/game/checkserver.jsp?user=" + encName + "&serverId=" + encodedHash;
|
||||
String authURL = "https://sessionserver.mojang.com/session/minecraft/hasJoined?username=" + encName + "&serverId=" + encID;
|
||||
|
||||
Callback<String> handler = new Callback<String>()
|
||||
{
|
||||
@ -270,13 +265,18 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
{
|
||||
if ( error == null )
|
||||
{
|
||||
if ( "YES".equals( result ) )
|
||||
JsonObject obj = BungeeCord.getInstance().gson.fromJson( result, JsonObject.class );
|
||||
if ( obj != null )
|
||||
{
|
||||
finish();
|
||||
} else
|
||||
{
|
||||
disconnect( "Not authenticated with Minecraft.net" );
|
||||
JsonElement id = obj.get( "id" );
|
||||
if ( id != null )
|
||||
{
|
||||
UUID = id.getAsString();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
disconnect( "Not authenticated with Minecraft.net" );
|
||||
} else
|
||||
{
|
||||
disconnect( bungee.getTranslation( "mojang_fail" ) );
|
||||
|
@ -36,7 +36,15 @@ public class HttpHandler extends SimpleChannelInboundHandler<HttpObject>
|
||||
if ( msg instanceof HttpResponse )
|
||||
{
|
||||
HttpResponse response = (HttpResponse) msg;
|
||||
if ( response.getStatus().code() != 200 )
|
||||
int responseCode = response.getStatus().code();
|
||||
|
||||
if ( responseCode == HttpResponseStatus.NO_CONTENT.code() )
|
||||
{
|
||||
done( ctx );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( responseCode != HttpResponseStatus.OK.code() )
|
||||
{
|
||||
throw new IllegalStateException( "Expected HTTP response 200 OK, got " + response.getStatus() );
|
||||
}
|
||||
@ -48,14 +56,19 @@ public class HttpHandler extends SimpleChannelInboundHandler<HttpObject>
|
||||
|
||||
if ( msg instanceof LastHttpContent )
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.done( buffer.toString(), null );
|
||||
} finally
|
||||
{
|
||||
ctx.channel().close();
|
||||
}
|
||||
done( ctx );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void done(ChannelHandlerContext ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.done( buffer.toString(), null );
|
||||
} finally
|
||||
{
|
||||
ctx.channel().close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user