mfnalex / ChestSort

Best sorting plugin for Minecraft / Spigot 1.14+
https://www.chestsort.de
GNU General Public License v3.0
91 stars 34 forks source link

Allow to disable chest sorting in certain world regions #69

Closed mindw0rm closed 4 years ago

mindw0rm commented 4 years ago

Is your feature request related to a problem? Please describe. I would like to generally allow the sorting of chests, but disable it for one or more specific regions of a world. To elaborate: we have a mine game on our server where every player is allowed to pick exactly one itemstack from each chest inside the game area. There are multiple stacks of the same item in a single chest which should not be combined when the chest is opened / closed / a sort hotkey used.

Describe the solution you'd like I see multiple possibilities to solve this for us:

  1. Send an event when you are about to sort an inventory and don't sort if the event is cancelled.
  2. Implement your own region handling. A simple solution like specifying regions with min-x, min-z, max-x and max-z in the config would be sufficient.
  3. Add a worldguard region flag that can prevent sorting.
  4. Since this is on a Plotsquared plot: add a plotsquared flag that can prevent sorting. Disclaimer: we still use Plotsquared 4.x since we have a plugin that relies heavily on the internals of it and didn't have time yet to update it to 5.x -- but since this is the least generic solution I won't recomend it anyway.

Describe alternatives you've considered Disable Chestsort completely during games (which is 1-2h every few months, plus a few days of setup). This of course has the disadvantage that chest can't be sorted outside the game area during that time.

Additional context We have our own plugin to handle the game, so the solution which imho is easiest to implement (event that can be cancelled) is quite sufficient. Other use cases (which I can't think of right now ;) ) might require a solution that doesn't depend on being able to add event listeners.

mfnalex commented 4 years ago

Thank you for the feature request.

I will have a look at this, however I have not worked with custom Spigot events so I have no idea how to implement it this way.

The max-x and max-z config options seems a bit odd to me, because probably noone would use it.

The worldguard region flag seems a good idea, though. I will have a look at the WorldGuard API and reply to this later.

mfnalex commented 4 years ago

I just had a look at the Spigot Event API and it seems waaaay easier to just create a custom event than custom WorldGuard flags. So, I would implement a custom event called ChestSortEvent or something similar that will be canceable if this is okay for you?

mfnalex commented 4 years ago

Please try the 8.8.3-pre1 version which is available here: https://github.com/JEFF-Media-GbR/Spigot-ChestSort/releases/tag/8.8.3-pre1

Let me know if everything is working as expected.

mfnalex commented 4 years ago

Does it work as expected?

mindw0rm commented 4 years ago

Sorry I hadn't time to test it yet, I'll notify you.

mindw0rm commented 4 years ago

It works as expected.

Thanks :)

mfnalex commented 4 years ago

You‘re welcome, it will be included in the next official release on SpigotMC :)

mfnalex commented 4 years ago

Now included in the 8.9 version which is also the first release in our new maven repo