lishid / OpenInv

Open anyone's inventory as a chest, real-time!
GNU General Public License v3.0
120 stars 97 forks source link

Duplicate item in my own inventory #182

Closed Fakhri1999 closed 3 years ago

Fakhri1999 commented 3 years ago

Description: I can duplicate item in my own inventory using this plugin

How to reproduce: Put 1 stackable item (with an amount less than the max amount of stackable, for example, "30 iron ingot") in your inventory and make sure there is no other item in your inventory. Then run the command "/openinv " and do "Shift + right click" or "Shift + left click" to the item (you can click to the opened GUI or to the inventory GUI)

Server version:

Jikoo commented 3 years ago

Interesting. I'm reasonably confident that that didn't happen on older versions, pretty much all "duplication" bugs ended up being either conflicts outside of OI's control or creative desync.

Jikoo commented 3 years ago

This will unfortunately not be an easy fix - OI doesn't reroute logic in a chest inventory, it piggybacks Minecraft's internals to create a container backed by another container's content list (the player inventory, in this case). Because of that, the issue here is caused by sections of code that OI generally has no business messing with.

As a bandaid, deny your untrustworthy players OpenInv.openself.

Fakhri1999 commented 3 years ago

can't you add a new if inside your code so when the user shift click, it will suddenly cancel the event? so people can only click without shift

Jikoo commented 3 years ago

Yes, but that's pretty poor in terms of QoL, the only reason you wouldn't shift-click everything is if you're trying to put something in a specific slot. Since there's a separate permission for opening your own inventory that can very easily be denied, that's an unnecessary and incomplete bandaid that hampers responsible users.