ProtocolLib

3M Downloads

ProtocolLib missing / ignoring PacketSetSlot when called many times

WillFP opened this issue ยท 2 comments

commented

Describe the bug
A packet adapter listening to PacketType.Play.Server.SET_SLOT will not have its onPacketSending method called if a player is sent many SetSlot packets. This has the side effect of breaking the core of the packet item display system in all of my plugins if a player moves many items around in an inventory.

To Reproduce
Steps to reproduce the behavior:

  1. Create a PacketAdapter for PacketSetSlot
  2. Trigger a large-ish number of packets by moving a bunch of items around in an inventory
  3. After a short amount of time, the PacketAdapter is no longer called, and the packets aren't processed

Expected behavior
The expected behaviour would be that all outgoing packets would always be processed and handled by the relevant PacketAdapters

Version Info
Provide your ProtocolLib install info with /protocol dump through pastebin.

Additional context
This bug causes visual glitches in EcoEnchants, EcoArmor, Talismans, EcoWeapons, Reforges, and EcoItems. I'm assuming it's a rate limiting thing, but that's purely speculation

commented

I'm listening to this packet too, but don't have this issue.
Maybe the item is sent via some other packet like WINDOW_ITEMS?
WINDOW_ITEMS also contains the additional field for slot -1 (cursor item) since 1.17.1 I believe. Previously only SET_SLOT was responsible for this. Maybe that could be the case.

Edit: I decided to take a quick look at EcoEnchants and yes, this seems to be it. eco's PacketWindowItems handles only itemListModifier. There should be an additional parser for itemModifier (same as in PacketSetSlot).

commented

I'm listening to this packet too, but don't have this issue. Maybe the item is sent via some other packet like WINDOW_ITEMS? WINDOW_ITEMS also contains the additional field for slot -1 (cursor item) since 1.17.1 I believe. Previously only SET_SLOT was responsible for this. Maybe that could be the case.

Edit: I decided to take a quick look at EcoEnchants and yes, this seems to be it. eco's PacketWindowItems handles only itemListModifier. There should be an additional parser for itemModifier (same as in PacketSetSlot).

I cannot thank you enough for this! Never realized this while reading wiki.vg - I'm adding you as credits in the next update. Thank you so much!