Interface CommandAPIPacket

All Known Implementing Classes:
ProtocolVersionTooOldPacket, SetVersionPacket, UpdateRequirementsPacket

public interface CommandAPIPacket
An interface for formatting messages that can be sent between separate instances of the CommandAPI.

The write(FriendlyByteBuffer, Object, int) method should be mirrored by a static deserialize(FriendlyByteBuffer input) method. This deserialize method can assume any bytes written by the write method will be present to reconstruct this packet from an array of bytes.

To set up a packet properly, it needs to be registered to one of the channels of CommandAPIProtocol. There, the packet's deserialize method will be linked to a protocol id. An appropriate method should be added to one of the implementations of CommandAPIPacketHandler to handle this packet when received.

It is also recommended to make the packet a record. This creates appropriate implementations for Object.toString(), Object.equals(Object), and Object.hashCode(), which helps with compatibility with certain error messages and the testing framework.