Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening from chests and barrels #6

Open
KyrVorga opened this issue Jul 4, 2023 · 3 comments
Open

Opening from chests and barrels #6

KyrVorga opened this issue Jul 4, 2023 · 3 comments
Labels
wontfix This will not be worked on

Comments

@KyrVorga
Copy link

KyrVorga commented Jul 4, 2023

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
Copy link
Owner

percyqaz commented Jul 4, 2023

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)

  • In any container multiple players can use at the same time:
    • Prevent other players from opening shulker boxes that are already open
    • Prevent other players from moving or dropping shulker boxes that are already open
  • In any container physically in a world:
    • In the event of a player breaking a container, force close a player out of any open shulker boxes + save their changes BEFORE processing the event
    • In the event of an explosion breaking a container, force close a player out of any open shulker boxes + save their changes BEFORE processing the event
    • Preventing hoppers and hopper minecarts from moving open shulker boxes
  • In droppers and dispensers:
    • Prevent the dropper/dispenser from dropping open shulker boxes (or don't add plugin support for these containers)
  • Probably more things that will be missed or that get added in future updates to the game

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 percyqaz added the good first issue Good for newcomers label Jul 4, 2023
@percyqaz
Copy link
Owner

percyqaz commented Jul 4, 2023

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
Copy link
Author

KyrVorga commented Jul 4, 2023

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.

@percyqaz percyqaz added wontfix This will not be worked on and removed good first issue Good for newcomers labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants