Remover Tool and Gather function isn't working well together

Since the introduction of the retrieve and gather button we have noticed something and I thought I would ask if this is normal. To reproduce the error:

  • turn on gather (all or excisting) in the backpack
  • for excisting: take only half of the stack of an item from the backpack and put it into the hot bar
  • equip the item
  • enter the command /remove

The item will now go directly back into the backpack to its stack.
With gather all it doesn't matter if the item is already in the backpack, the equipped item goes directly back into the backpack on a free slot as soon as you activate /remove. The mod seems to think it is a new item that you get.

If you turn off gather, the problem disappears. Also if you don't equip an item, the error is not present.

Is that normal behaviour or is it changeable? During the build it can be a bit annoying when the build plan always disappears in the backpack if you haven't turned off the gather button :-D Thanks in advance!

This happens because the Remover Tool force dequips your active item by removing and adding it back to your hotbar a fraction of a second later. This causes Backpacks to think it's a new item. The reason Remover Tool works this way is that it's not possible to make the client dequip an item any other way, due to the way the client is coded.

There are a few possible solutions.

  1. I could make Gather mode remember the last removed item, in order to not gather it if added in a short amount of time. Currently the plugin does this but only remembers the item for one frame. This would accommodate any plugin that does force dequiping.
  2. I could add an API to allow Remover Tool to disable gather mode temporarily. Remover Tool would also need a small update. Other plugins that implement gather mode would need a similar API, and Remover Tool would probably need to be aware of them as well.
  3. We could devise custom flags for players or items, as a more plugin-agnostic standard specification for how to disable gathering specific items. Remover Tool would set a temporarily flag on the item before adding it back to the players inventory. Backpacks and other plugins could check if that flag is set in order to prevent gathering it.
  4. I could add a config in Backpacks that allows you to define a list of specific commands. If those commands are executed by a player, the plugin would temporarily pause gather mode for that player for a configurable duration. Then you could update your config to listen for the commands that Remover Tool uses, in order to automatically pause gather mode for about a second.
There's also the possibility of redesigning gather mode to be coded to specific events rather than a catch-all like it is now. I previously decided against this direction because of the performance implications of many hooks, but I might revisit this as an option in the future, aimed at servers where performance is less of a concern. 

Thank you for that fast respond! 
I don't know what's the easiest way for you? I suppose option 4 would involve the least other plugins? So less trouble? In our case I could add the command /remove and deactivate it for one second and it would be solved, i guess ^^