Regression bug in commit af33a2ab41199f7c564a5ca9f919e91822532cf4
nickuc opened this issue ยท 3 comments
- This issue is not solved in a development build
Describe the bug
When registering an event that listens for the handshake packet (SET_PROTOCOL), an "Incompatible version!" will appear in motd. This bug was introduced in build #670 (most likely by commit af33a2a). Build #669 does not have the same problem.
To Reproduce
Steps to reproduce the behavior:
- Download and install latest build.
- Intercept the SET_PROTOCOL packet as the following example:
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, PacketType.Handshake.Client.SET_PROTOCOL) {
@Override
public void onPacketReceiving(PacketEvent event) {
// packet received
}
});
- See error
Expected behavior
Have the same behavior as build #669.
Screenshots
#669
Version Info
Provide your ProtocolLib install info with /protocol dump
through pastebin.
Additional context
No additional context.
#2593 seems to be the same problem
Right, #2593 it's exactly the same issue.
TCPShield registration: https://github.com/TCPShield/RealIP/blob/bb7511d37f915ea1b8416ac24dd8564b9d3d0e20/src/main/java/net/tcpshield/tcpshield/bukkit/protocollib/handler/ProtocolLibHandshakeHandler.java#L18
AdvancedNMotd registration: https://github.com/NamerPRO/AdvancedNMotd/blob/b764e435696ca9b5fc0a0ef1a77e417261e9dee2/src/ru/namerpro/AdvancedNMotd/Bukkit/Main.java#L61
The problem is PacketType.Handshake.Client.SET_PROTOCOL
packet changes client protocol before calling NetworkManagerInjector.onPacketReceiving()
. So in NetworkManagerInjector.onPacketReceiving()
ProtocolLib tries to get PacketType by PacketType.Protocol.STATUS
or PacketType.Protocol.LOGIN
protocols, but not PacketType.Protocol.HANDSHAKING
which is actually stored in PacketRegistry.REGISTER.protocolClassToType
.
That is why PacketRegistry.getPacketType(PacketType.Protocol, Class<?>)
returns null and tries to create PacketContainer with null PacketType.
UPD: There are high amount of issues coming in right now due to:
- Many people are using the ProtocolLib release from SpigotMC (v5.1.0)
- Many people are using 1.20 or 1.20.1 server software instead of 1.20.2
- Those using the latest development build are getting the issue described here
In addition, most issues lack the necessary technical information. Therefore, I would recommend to fix this issue ASAP and public it on SpigotMC. Below is a long list of issues that can be related with described situation