percyqaz / UltimateInventory

Minecraft server plugin to streamline inventory management - Supports PaperMC and SpigotMC
https://www.spigotmc.org/resources/ultimate-inventory-1-19-1-20.109298/
MIT License
9 stars 1 forks source link

Opening from chests and barrels #6

Open KyrVorga opened 1 year ago

KyrVorga commented 1 year ago

Hi, is there any particular reason for users not being able to open shulkers from chests or barrels?

I was going to fork the repo to add this and anvil support, but I see you're working on the anvil part :)

percyqaz commented 1 year ago

Opening shulker boxes from chests and barrels is not supported

I personally keep a lot of shulker boxes in my ender chest - You can always place a shulker box from a chest into your inventory and then open it if you are using a conventional storage room

The reason you can't open shulkers from chests or barrels is because other players can have the inventory open at the same time (amongst other duplication hazards like breaking or blowing up the container)

The plugin works by saving the contents of the shulker box only when the player looking inside closes the box, so if anyone else changes the slot before that player closes the box, their changes will be saved to the wrong place which leads to item loss or item duplication

To prevent duplication exploits, we would need to do at least the following: (there may be more)

It would take an extremely experienced Spigot plugin developer (so not me) to do all of this, therefore I do not plan to support this, I also don't know how much of this list is possible exactly as described using Spigot's API


Hence feel free to fork the repo to add these features, and PRs are welcome, however I will only accept a PR if I have full confidence that there are no duplication exploits

I consider opening shulker boxes with currently no known duplication bugs to be the "main feature" of this plugin and wouldn't want to compromise this

Hope that explanation helps, if it's not clear or you want to understand better because you are implementing this let me know

percyqaz commented 1 year ago

P.S - what are your thoughts on anvil support and how it should work? The reason I haven't added it yet is because I'm not sure how to deal with anvil durability damage

The anvil could have the same probability of taking damage as it does when placed, but again for 100% no exploits, anvils would need the same kind of slot protections that shulker boxes do so that the correct item stack can be updated

It could also just not take any damage but that incentivises players never to place their anvils because it's cheaper to use them in the inventory - Is that important to you?

More info can be found in #5

KyrVorga commented 1 year ago

Thanks for your reply. I will fork and add in the features. I plan to add chest support without any checks first to see exactly where things go wrong. My server has a /anvil command, so we do not mind the durability.