EpicBanItemTeam / VirtualChest

A sponge plugin providing virtual chest GUIs for menus like ChestCommands
https://ore.spongepowered.org/zzzz/VirtualChest
GNU Lesser General Public License v3.0
34 stars 12 forks source link

Actions with `KeepInvenrtoryOpen: false` can run multiple times #99

Closed Aaron1011 closed 5 years ago

Aaron1011 commented 5 years ago

In fireClickEvent, the inventory is scheduled to be closed on the next tick, if the action indicated that it would be closed. However, it's possible for multiple click events for the same slot to be fired during the same tick (e.g. due to server lag). If this happens, VirtualChest will execute the action multiple times, since the inventory is still open.

To fix this, VirtualChest should stop processing all actions once an action marks an inventory as closed, even if it receives more events for that inventory.

ustc-zzzz commented 5 years ago

This problem could be reduced by either setting the value of acceptable-action-interval-tick in virtualchest.conf or adding a field named AcceptableActionIntervalTick in your menu config file. The default value is 0, which means that all the click actions could be submitted all the time while the max speed of submitting click actions will be limited to once per tick if it is set to 1.