Java 类net.minecraft.network.login.server.SPacketEncryptionRequest 实例源码

项目:ClientAPI    文件:MixinNetHandlerLoginClient.java   
/**
 * Hook for EncryptionRequestEvent
 *
 * @see EncryptionRequestEvent
 */
@Inject(method = "handleEncryptionRequest", at = @At("HEAD"), cancellable = true)
private void onLoginEncryptionRequest(SPacketEncryptionRequest packet, CallbackInfo ci) {
    EncryptionRequestEvent event = new EncryptionRequestEvent((NetHandlerLoginClient) (Object) this, packet);
    EVENT_BUS.post(event);
    if (event.isCancelled())
        ci.cancel();
}
项目:Backmemed    文件:NetHandlerLoginServer.java   
public void processLoginStart(CPacketLoginStart packetIn)
{
    Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.HELLO, "Unexpected hello packet", new Object[0]);
    this.loginGameProfile = packetIn.getProfile();

    if (this.server.isServerInOnlineMode() && !this.networkManager.isLocalChannel())
    {
        this.currentLoginState = NetHandlerLoginServer.LoginState.KEY;
        this.networkManager.sendPacket(new SPacketEncryptionRequest("", this.server.getKeyPair().getPublic(), this.verifyToken));
    }
    else
    {
        this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
    }
}
项目:CustomWorldGen    文件:NetHandlerLoginServer.java   
public void processLoginStart(CPacketLoginStart packetIn)
{
    Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.HELLO, "Unexpected hello packet", new Object[0]);
    this.loginGameProfile = packetIn.getProfile();

    if (this.server.isServerInOnlineMode() && !this.networkManager.isLocalChannel())
    {
        this.currentLoginState = NetHandlerLoginServer.LoginState.KEY;
        this.networkManager.sendPacket(new SPacketEncryptionRequest("", this.server.getKeyPair().getPublic(), this.verifyToken));
    }
    else
    {
        this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
    }
}
项目:ClientAPI    文件:EncryptionRequestEvent.java   
/**
 * @param hetHandler the NetHandlerLoginClient object that received the request
 * @param packet the encryption request packet
 */
public EncryptionRequestEvent(NetHandlerLoginClient hetHandler, SPacketEncryptionRequest packet) {
    this.net = hetHandler;
    this.packet = packet;
}
项目:ClientAPI    文件:EncryptionRequestEvent.java   
/**
 * @return the encryption request packet
 */
public SPacketEncryptionRequest getPacket() {
    return packet;
}
项目:Backmemed    文件:NetHandlerLoginClient.java   
public void handleEncryptionRequest(SPacketEncryptionRequest packetIn)
{
    final SecretKey secretkey = CryptManager.createNewSharedKey();
    String s = packetIn.getServerId();
    PublicKey publickey = packetIn.getPublicKey();
    String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);

    if (this.mc.getCurrentServerData() != null && this.mc.getCurrentServerData().isOnLAN())
    {
        try
        {
            this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
        }
        catch (AuthenticationException var10)
        {
            LOGGER.warn("Couldn\'t connect to auth servers but will continue to join LAN");
        }
    }
    else
    {
        try
        {
            this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
        }
        catch (AuthenticationUnavailableException var7)
        {
            this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {new TextComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
            return;
        }
        catch (InvalidCredentialsException var8)
        {
            this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {new TextComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
            return;
        }
        catch (AuthenticationException authenticationexception)
        {
            this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
            return;
        }
    }

    this.networkManager.sendPacket(new CPacketEncryptionResponse(secretkey, publickey, packetIn.getVerifyToken()), new GenericFutureListener < Future <? super Void >> ()
    {
        public void operationComplete(Future <? super Void > p_operationComplete_1_) throws Exception
        {
            NetHandlerLoginClient.this.networkManager.enableEncryption(secretkey);
        }
    }, new GenericFutureListener[0]);
}
项目:CustomWorldGen    文件:NetHandlerLoginClient.java   
public void handleEncryptionRequest(SPacketEncryptionRequest packetIn)
{
    final SecretKey secretkey = CryptManager.createNewSharedKey();
    String s = packetIn.getServerId();
    PublicKey publickey = packetIn.getPublicKey();
    String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);

    if (this.mc.getCurrentServerData() != null && this.mc.getCurrentServerData().isOnLAN())
    {
        try
        {
            this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
        }
        catch (AuthenticationException var10)
        {
            LOGGER.warn("Couldn\'t connect to auth servers but will continue to join LAN");
        }
    }
    else
    {
        try
        {
            this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
        }
        catch (AuthenticationUnavailableException var7)
        {
            this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {new TextComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
            return;
        }
        catch (InvalidCredentialsException var8)
        {
            this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {new TextComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
            return;
        }
        catch (AuthenticationException authenticationexception)
        {
            this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
            return;
        }
    }

    this.networkManager.sendPacket(new CPacketEncryptionResponse(secretkey, publickey, packetIn.getVerifyToken()), new GenericFutureListener < Future <? super Void >> ()
    {
        public void operationComplete(Future <? super Void > p_operationComplete_1_) throws Exception
        {
            NetHandlerLoginClient.this.networkManager.enableEncryption(secretkey);
        }
    }, new GenericFutureListener[0]);
}
项目:ExpandedRailsMod    文件:NetHandlerLoginClient.java   
public void handleEncryptionRequest(SPacketEncryptionRequest packetIn)
{
    final SecretKey secretkey = CryptManager.createNewSharedKey();
    String s = packetIn.getServerId();
    PublicKey publickey = packetIn.getPublicKey();
    String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);

    if (this.mc.getCurrentServerData() != null && this.mc.getCurrentServerData().isOnLAN())
    {
        try
        {
            this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
        }
        catch (AuthenticationException var10)
        {
            LOGGER.warn("Couldn\'t connect to auth servers but will continue to join LAN");
        }
    }
    else
    {
        try
        {
            this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1);
        }
        catch (AuthenticationUnavailableException var7)
        {
            this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {new TextComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])}));
            return;
        }
        catch (InvalidCredentialsException var8)
        {
            this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {new TextComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])}));
            return;
        }
        catch (AuthenticationException authenticationexception)
        {
            this.networkManager.closeChannel(new TextComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()}));
            return;
        }
    }

    this.networkManager.sendPacket(new CPacketEncryptionResponse(secretkey, publickey, packetIn.getVerifyToken()), new GenericFutureListener < Future <? super Void >> ()
    {
        public void operationComplete(Future <? super Void > p_operationComplete_1_) throws Exception
        {
            NetHandlerLoginClient.this.networkManager.enableEncryption(secretkey);
        }
    }, new GenericFutureListener[0]);
}
项目:Backmemed    文件:INetHandlerLoginClient.java   
void handleEncryptionRequest(SPacketEncryptionRequest packetIn);
项目:CustomWorldGen    文件:INetHandlerLoginClient.java   
void handleEncryptionRequest(SPacketEncryptionRequest packetIn);