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:
Kristian S. Stangeland 2014-05-11 15:33:15 +02:00
parent d415bd7643
commit 818ac5cbde
3 changed files with 7 additions and 4 deletions

View File

@ -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));
}
/**

View File

@ -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();

View File

@ -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));
}
}
}
}