MLG-Fortress / AutomaticInventory

Automatically sort, refill, and replace items in any inventory
https://dev.bukkit.org/projects/automatic-inventory
GNU General Public License v3.0
3 stars 14 forks source link

Inventory Sorting Not Working on 1.16.1 #35

Closed MinesAndValleys closed 4 years ago

MinesAndValleys commented 4 years ago

In my testing, inventories are not sorting themselves, but chests are. Minecraft version 1.16.1.   Testing Sort on: https://cldup.com/9n9V02-Z2W.png Plugin version: https://cldup.com/NnxOf4GULp.png Sorting broken: https://cldup.com/S386fWstsG.png

RoboMWM commented 4 years ago

inventories as in... player inventories? Because chests are inventories too.

MinesAndValleys commented 4 years ago

Update: I noticed my inventory was being sorted but only while opening a chest. So, the sorting is not being performed when opening the inventory.

And that's right, I mean player inventories only when writing inventory. It's meant in the same way common speech and this plugin describe an inventory. Typing /AutoSort gives options for sorting either "inventories" or "chests" – and the former is what is causing an issue after the update to 1.16.

RoboMWM commented 4 years ago

yea, I guess I should change the default wording BigScary used. Anyways that indicates that the InventoryCloseEvent is no longer fired for players who close their own inventory (it never fired when they opened it but did when they closed it - which is what this plugin uses to track that afaik, along with the pickup event).

Of course, another plugin may be messing around with this event, so if you can double check if it happens with just AutomaticInventory installed that'd be helpful as well.

MinesAndValleys commented 4 years ago

Okay, I just did your test loading just that one plugin, and ran the server. The result was the same in that it would not sort my player inventory without using a chest.

Also, I checked the Wiki, I didn't know chests are "inventories" on there. But I'd prefer to keep the wording the same, since people often say things like "let me check my chests it's not in my inventory" when playing the game. Though if it's customizable in the language file, it doesn't matter all that much.

TheoRetisch1 commented 4 years ago

I'm facing the same problem using Paper 1.16.1 #130 and AutomaticInventory version 2.10.1-a8f1fec.

RoboMWM commented 4 years ago

finally had an opportunity to test, and this appears to be the case... or at least I don't see any event being fired when I close my inventory. It used to fire InventoryCloseEvent, so I guess the client just doesn't do that anymore.

RoboMWM commented 4 years ago

Currently busy with other stuff right now but I'll try to check on this in a week, ping me here otherwise. This will require a bit of a redesign (similar to a feature request) since the old method (watching InventoryCloseEvent) simply will not work anymore. If anyone has any suggestions on when the sorting should be performed please let me know. Currently I believe it also occurs on the pickup event.

RoboMWM commented 4 years ago

Right now the only idea I have is this, how does this sound?

When a player clicks in their own inventory And they have no inventory open (or their own, if this is possible to discover) Then start a timer of predetermined length

Before the timer expires When a player clicks in their inventory Then reset the timer

When the timer expires Then sort the player's inventory

TheoRetisch1 commented 4 years ago

Confirmed for Paper 1.16.3 build 198.

RoboMWM commented 4 years ago

Ah, knew I was forgetting something here, thanks.

RoboMWM commented 4 years ago

Defaulting to 8 seconds. I could make this configurable but may be better to "adapt" if possible, but that's for a separate feature request if the need is warranted.

TheoRetisch1 commented 4 years ago

I compiled the build but it doesn't work for me? I can't figure out how to sort the inventory. How does the new mechanism work?

RoboMWM commented 4 years ago

Should be that any time you click something in your inventory when you have only your player inventory open, it'll start a countdown of 8 seconds, which will then cause your inventory to be sorted. The Inventory stuff is a little weird so I may have gotten it wrong, but I used similar logic so idk if there's something I'm not accounting for.

TheoRetisch1 commented 4 years ago

I tested it again on a different test server, no luck. All sort feature work, but the inventory won't sort. I tried it with different permission and toggled the sorting. There are no errors, the inventory just won't sort. maybe I made a mistake compiling the build. I will wait for a release build to try it again :)

RoboMWM commented 4 years ago

I made a release but no I haven't had time to test since the logic should be similar... I guess the player inventory works differently...

RoboMWM commented 4 years ago

k, used the wrong event name, fixed and tested.

TheoRetisch1 commented 4 years ago

It works, thank you very much 💯

RoboMWM commented 3 years ago

apparently inventorycloseevent is now working again in later 1.16 releases... so I might revert this.

TheoRetisch1 commented 3 years ago

That would be cool, the old system was more intuitive :)