Git Product home page Git Product logo

Comments (2)

aadnk avatar aadnk commented on August 20, 2024

Right - PacketContainer yields access to the internal fields in the packet class, not the serialized packet data as seen on the wire. So, if we take the SCOREBOARD_TEAM packet:

public class PacketPlayOutScoreboardTeam extends Packet {
  private String a = "";
  private String b = "";
  private String c = "";
  private String d = "";
  private Collection e = new ArrayList();
  private int f;
  private int g;
// ..
  public void a(PacketDataSerializer paramPacketDataSerializer) {
    this.a = paramPacketDataSerializer.c(16);
    this.f = paramPacketDataSerializer.readByte();

    if ((this.f == 0) || (this.f == 2)) {
      this.b = paramPacketDataSerializer.c(32);
      this.c = paramPacketDataSerializer.c(16);
      this.d = paramPacketDataSerializer.c(16);
      this.g = paramPacketDataSerializer.readByte();
    }

    if ((this.f == 0) || (this.f == 3) || (this.f == 4)) {
      int i = paramPacketDataSerializer.readShort();

      for (int j = 0; j < i; j++)
        this.e.add(paramPacketDataSerializer.c(16));
    }
  }

You have to use integers for action and friendly fire, not bytes. And a collection modifier to write the string collection:

packet.getModifier().<Collection>withType(Collection.class).write(0, null);

from protocollib.

md-5 avatar md-5 commented on August 20, 2024

Interesting.
It was working before (as far as I know), so I guess there was some kind of regression that made byte not work.
I'll update the code accordingly tomorrow, thanks for your help.

from protocollib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.