Example #1
0
 public void a(EnumProtocol enumprotocol, EnumProtocol enumprotocol1) {
   Validate.validState(
       this.g == EnumProtocolState.e || this.g == EnumProtocolState.HELLO,
       "Unexpected change in protocol",
       new Object[0]);
   Validate.validState(
       enumprotocol1 == EnumProtocol.PLAY || enumprotocol1 == EnumProtocol.LOGIN,
       "Unexpected protocol " + enumprotocol1,
       new Object[0]);
 }
Example #2
0
 public void a(PacketLoginInEncryptionBegin packetlogininencryptionbegin) {
   Validate.validState(this.g == EnumProtocolState.KEY, "Unexpected key packet", new Object[0]);
   PrivateKey privatekey = this.server.K().getPrivate();
   if (!Arrays.equals(this.e, packetlogininencryptionbegin.b(privatekey))) {
     throw new IllegalStateException("Invalid nonce!");
   } else {
     this.loginKey = packetlogininencryptionbegin.a(privatekey);
     this.g = EnumProtocolState.AUTHENTICATING;
     this.networkManager.a(this.loginKey);
     POOL.execute(new ThreadPlayerLookupUUID(this, "User Authenticator"));
   }
 }
Example #3
0
 public void a(PacketLoginInStart packetlogininstart) {
   Validate.validState(
       this.g == EnumProtocolState.HELLO, "Unexpected hello packet", new Object[0]);
   this.i = packetlogininstart.c();
   if (this.server.getOnlineMode() && !this.networkManager.c()) {
     this.g = EnumProtocolState.KEY;
     this.networkManager.handle(
         new PacketLoginOutEncryptionBegin(this.j, this.server.K().getPublic(), this.e),
         new GenericFutureListener[0]);
   } else {
     POOL.execute(new ThreadPlayerLookupUUID(this, "User Authenticator"));
   }
 }
Example #4
0
  private void a(ServerPing serverping) {
    File file1 = this.d("server-icon.png");

    if (file1.isFile()) {
      ByteBuf bytebuf = Unpooled.buffer();

      try {
        BufferedImage bufferedimage = ImageIO.read(file1);

        Validate.validState(
            bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
        Validate.validState(
            bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
        ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf));
        ByteBuf bytebuf1 = Base64.encode(bytebuf);

        serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
      } catch (Exception exception) {
        i.error("Couldn\'t load server icon", exception);
      } finally {
        bytebuf.release();
      }
    }
  }