Getting MinecraftKey from Listener CUSTOM_PAYLOAD 1.20.5+
deHasher opened this issue · 1 comments
Make sure you're doing the following
- [✓] You're using the latest build for your server version
- [✓] This isn't an issue caused by another plugin
- [✓] You've checked for duplicate issues
- [✓] You didn't use
/reload
Describe the question
On version 1.20.5-1.20.6+ my getChannel() method was broken, how can I fix this?
As I understand it, the structure has changed a lot and now something like handle.getStreamCodecs() should be used)
Code
public class WrapperPlayClientCustomPayload extends AbstractPacket {
public static final PacketType TYPE = PacketType.Play.Client.CUSTOM_PAYLOAD;
public WrapperPlayClientCustomPayload() {
super(new PacketContainer(TYPE), TYPE);
handle.getModifier().writeDefaults();
}
public WrapperPlayClientCustomPayload(PacketContainer packet) {
super(packet, TYPE);
}
public MinecraftKey getChannel() {
// return handle.getMinecraftKeys().readSafely(0); // 1.16.5-1.20.1
return handle.getCustomPacketPayloads().readSafely(0).getId(); // 1.20.2-1.20.4
}
}