Java 类net.minecraft.network.packet.Packet253ServerAuthData 实例源码

项目:RuneCraftery    文件:NetLoginHandler.java   
public void func_72500_a(Packet2ClientProtocol p_72500_1_) {
   if(this.field_72543_h != null) {
      this.func_72527_a("Quit repeating yourself!");
   } else {
      this.field_72543_h = p_72500_1_.func_73454_f();
      if(!this.field_72543_h.equals(StringUtils.func_76338_a(this.field_72543_h))) {
         this.func_72527_a("Invalid username!");
      } else {
         PublicKey var2 = this.field_72534_f.func_71250_E().getPublic();
         if(p_72500_1_.func_73453_d() != 78) {
            if(p_72500_1_.func_73453_d() > 78) {
               this.func_72527_a("Outdated server!");
            } else {
               this.func_72527_a("Outdated client!");
            }

         } else {
            this.field_72541_j = this.field_72534_f.func_71266_T()?Long.toString(field_72537_e.nextLong(), 16):"-";
            this.field_72536_d = new byte[4];
            field_72537_e.nextBytes(this.field_72536_d);
            this.field_72538_b.func_74429_a(new Packet253ServerAuthData(this.field_72541_j, var2, this.field_72536_d));
         }
      }
   }
}
项目:RuneCraftery    文件:NetClientHandler.java   
public void handleServerAuthData(Packet253ServerAuthData par1Packet253ServerAuthData)
{
    String s = par1Packet253ServerAuthData.getServerId().trim();
    PublicKey publickey = par1Packet253ServerAuthData.getPublicKey();
    SecretKey secretkey = CryptManager.createNewSharedKey();

    if (!"-".equals(s))
    {
        String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);
        String s2 = this.sendSessionRequest(this.mc.getSession().getUsername(), this.mc.getSession().getSessionID(), s1);

        if (!"ok".equalsIgnoreCase(s2))
        {
            this.netManager.networkShutdown("disconnect.loginFailedInfo", new Object[] {s2});
            return;
        }
    }

    this.addToSendQueue(new Packet252SharedKey(secretkey, publickey, par1Packet253ServerAuthData.getVerifyToken()));
}
项目:BetterNutritionMod    文件:NetClientHandler.java   
public void handleServerAuthData(Packet253ServerAuthData par1Packet253ServerAuthData)
{
    String s = par1Packet253ServerAuthData.getServerId().trim();
    PublicKey publickey = par1Packet253ServerAuthData.getPublicKey();
    SecretKey secretkey = CryptManager.createNewSharedKey();

    if (!"-".equals(s))
    {
        String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16);
        String s2 = this.sendSessionRequest(this.mc.getSession().getUsername(), this.mc.getSession().getSessionID(), s1);

        if (!"ok".equalsIgnoreCase(s2))
        {
            this.netManager.networkShutdown("disconnect.loginFailedInfo", new Object[] {s2});
            return;
        }
    }

    this.addToSendQueue(new Packet252SharedKey(secretkey, publickey, par1Packet253ServerAuthData.getVerifyToken()));
}
项目:RuneCraftery    文件:NetClientHandler.java   
public void func_72470_a(Packet253ServerAuthData p_72470_1_) {
   String var2 = p_72470_1_.func_73377_d().trim();
   PublicKey var3 = p_72470_1_.func_73376_f();
   SecretKey var4 = CryptManager.func_75890_a();
   if(!"-".equals(var2)) {
      String var5 = (new BigInteger(CryptManager.func_75895_a(var2, var3, var4))).toString(16);
      String var6 = this.func_72550_a(this.field_72563_h.func_110432_I().func_111285_a(), this.field_72563_h.func_110432_I().func_111286_b(), var5);
      if(!"ok".equalsIgnoreCase(var6)) {
         this.field_72555_g.func_74424_a("disconnect.loginFailedInfo", new Object[]{var6});
         return;
      }
   }

   this.func_72552_c(new Packet252SharedKey(var4, var3, p_72470_1_.func_73378_g()));
}
项目:RuneCraftery    文件:NetLoginHandler.java   
public void handleClientProtocol(Packet2ClientProtocol par1Packet2ClientProtocol)
{
    if (this.clientUsername != null)
    {
        this.raiseErrorAndDisconnect("Quit repeating yourself!");
    }
    else
    {
        this.clientUsername = par1Packet2ClientProtocol.getUsername();

        if (!this.clientUsername.equals(StringUtils.stripControlCodes(this.clientUsername)))
        {
            this.raiseErrorAndDisconnect("Invalid username!");
        }
        else
        {
            PublicKey publickey = this.mcServer.getKeyPair().getPublic();

            if (par1Packet2ClientProtocol.getProtocolVersion() != 78)
            {
                if (par1Packet2ClientProtocol.getProtocolVersion() > 78)
                {
                    this.raiseErrorAndDisconnect("Outdated server!");
                }
                else
                {
                    this.raiseErrorAndDisconnect("Outdated client!");
                }
            }
            else
            {
                this.loginServerId = this.mcServer.isServerInOnlineMode() ? Long.toString(rand.nextLong(), 16) : "-";
                this.verifyToken = new byte[4];
                rand.nextBytes(this.verifyToken);
                this.myTCPConnection.addToSendQueue(new Packet253ServerAuthData(this.loginServerId, publickey, this.verifyToken));
            }
        }
    }
}
项目:BetterNutritionMod    文件:NetLoginHandler.java   
public void handleClientProtocol(Packet2ClientProtocol par1Packet2ClientProtocol)
{
    if (this.clientUsername != null)
    {
        this.raiseErrorAndDisconnect("Quit repeating yourself!");
    }
    else
    {
        this.clientUsername = par1Packet2ClientProtocol.getUsername();

        if (!this.clientUsername.equals(StringUtils.stripControlCodes(this.clientUsername)))
        {
            this.raiseErrorAndDisconnect("Invalid username!");
        }
        else
        {
            PublicKey publickey = this.mcServer.getKeyPair().getPublic();

            if (par1Packet2ClientProtocol.getProtocolVersion() != 78)
            {
                if (par1Packet2ClientProtocol.getProtocolVersion() > 78)
                {
                    this.raiseErrorAndDisconnect("Outdated server!");
                }
                else
                {
                    this.raiseErrorAndDisconnect("Outdated client!");
                }
            }
            else
            {
                this.loginServerId = this.mcServer.isServerInOnlineMode() ? Long.toString(rand.nextLong(), 16) : "-";
                this.verifyToken = new byte[4];
                rand.nextBytes(this.verifyToken);
                this.myTCPConnection.addToSendQueue(new Packet253ServerAuthData(this.loginServerId, publickey, this.verifyToken));
            }
        }
    }
}
项目:forge_world_downloader    文件:WDLNetClientHandler.java   
@Override
public void handleServerAuthData(Packet253ServerAuthData par1Packet253ServerAuthData)
{
    nch.handleServerAuthData(par1Packet253ServerAuthData);

}
项目:RuneCraftery    文件:NetHandler.java   
public void func_72470_a(Packet253ServerAuthData p_72470_1_) {
   this.func_72509_a(p_72470_1_);
}