mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-24 03:25:29 +01:00
Correct a bug that would lead to IllegalStateException in plugins.
This was caused by the fact that "requireInputBuffer" used findLegacy(int) to get the correct PacketType, instead of findLegacy(int, Sender.CLIENT). The latter is justified by the fact that only client-side packets require an input buffer.
This commit is contained in:
parent
d415bd7643
commit
818ac5cbde
@ -591,7 +591,7 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
|
||||
|
||||
@Override
|
||||
public boolean requireInputBuffer(int packetId) {
|
||||
return inputBufferedPackets.contains(PacketType.findLegacy(packetId));
|
||||
return inputBufferedPackets.contains(PacketType.findLegacy(packetId, Sender.CLIENT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -361,7 +361,8 @@ class ProxyPacketInjector implements PacketInjector {
|
||||
|
||||
// Remove every packet handler
|
||||
for (Integer id : previous.keySet().toArray(new Integer[0])) {
|
||||
removePacketHandler(PacketType.findLegacy(id));
|
||||
removePacketHandler(PacketType.findLegacy(id, Sender.CLIENT));
|
||||
removePacketHandler(PacketType.findLegacy(id, Sender.SERVER));
|
||||
}
|
||||
|
||||
overwritten.clear();
|
||||
|
@ -697,8 +697,10 @@ class ProxyPlayerInjectionHandler implements PlayerInjectionHandler {
|
||||
);
|
||||
|
||||
// These are illegal
|
||||
for (int packetID : result.getPackets())
|
||||
removePacketHandler(PacketType.findLegacy(packetID));
|
||||
for (int packetID : result.getPackets()) {
|
||||
removePacketHandler(PacketType.findLegacy(packetID, Sender.CLIENT));
|
||||
removePacketHandler(PacketType.findLegacy(packetID, Sender.SERVER));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user