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 2 forks source link

Right-click on open shulker boxes/crafting stations to return to normal inventory view #12

Open takatalvi opened 8 months ago

takatalvi commented 8 months ago

Hi, I'm very happy with the plugin and thanks to the permission nodes, i can give my players inventory enhancements based on their advancement completion, which is perfect. The plugin works really well, there are no bugs, no lagging, it's just seamless. I was just wondering if it's possible to trigger opening the main inventory when you right-click on the currently opened shulker box or other item.

When you open the inventory, you right-click a shulker box and the GUI changes to its inventory. The shulker box itself is still visible in its slot, but it can't be moved (for a good reason). You can open a different box by clicking on it, which is perfect, but you can only return to your main inventory by closing the GUI and opening it again. So I was thinking if clicking (righ-clicking?) the shulker box could return you back to your main inventory screen. It would make the usage even more dynamic, but I'm not sure if the actions and events allow for this.

Anyway, thanks for reading and thanks for this wonderful QoL plugin :)

percyqaz commented 8 months ago

Hi there, I'm very pleased to hear you're enjoying the plugin :) The whole purpose of the plugin is QoL and making inventory management more seamless, so I like this suggestion a lot, thanks

For your (and also my) insight, here's how I currently use the plugin:

Now, my shulker boxes/crafting stations aren't visible any more, I can only see my own inventory and the shulker box's contents

But now I can:

So it looks to me like I already did this for enderchests, and simply overlooked this for everything else I don't see why I can't add this behaviour for open shulker boxes and open crafting stations too, but there may have been some other annoyance by enabling it that I deliberately avoided when I originally made the plugin

I'll have a go at making this change when I next have some free time and report back either with a new release or any issues I find

takatalvi commented 8 months ago

Thank you for the quick reply, it sounds really promising. Seems like if it's possible for the ender chest, it should be doable for other objects as well, right? Even if it might be a bit of a niche use case, I think it would be worth adding at least for parity. On my server, I'm not planning on allowing ender chest access and crafters just yet, maybe over time as rewards for further survival progress. But I'm sure there are many users of the plugin who will appreciate the improved user experience. I'm really curious what will come out of this, but if it works out, it will be just perfect. Crossing my fingers :)

percyqaz commented 8 months ago

Foolish quote from me earlier today (clueless):

Right click on the ender chest while it's open to close it, and I'm back on my inventory

I misremembered this, and I now remember my thought process when I originally wrote the majority of the plugin

When you right click on an open ender chest, it actually closes your inventory window entirely It is unfortunately not possible for a plugin to tell your Minecraft client to open the normal inventory screen (see this forum post and lots like it) - there is simply not a packet in the protocol you can send for this, opening the normal player inventory can only be done by the client when pressing the inventory key

This leaves only the option to close the inventory screen entirely (so you are looking at the world again) upon right clicking something that's open

I'm sure I knew this last year, and that's why I didn't bother making the plugin completely kick you out of the inventory screen when right clicking on something that's open - it feels worse/more abrupt to me in testing than if it just did nothing

Therefore I'm sorry to say this feature is impossible right now when playing with a vanilla client, unless Mojang changes the protocol (the same kind of thing prevents the plugin working in the creative menu) :(

What do you think about right-clicking on open containers closing the screen entirely? I can add that for consistency with ender chests, but I'm currently thinking it isn't worth it as it's slower than just pressing the inventory key (I believe this was also my reasoning last year)

takatalvi commented 8 months ago

I can't say I wasn't expecting a roadblock like this, I completely understand. In that case, maybe it could be solved by an option in the config? something like close-inventory-on-click: true/false I don't want to disrupt the existing behavior, but if it's not too much work, maybe it would be helpful in some cases. I know pressing the inventory key or Esc is quicker in most cases, but at least in my experience, it can be comfortable to have more options, like also using the mouse. I'll leave it up to you, I like the plugin in the current state and plan on keeping it. Thank you :)

percyqaz commented 8 months ago

I may bundle a setting like that with a future update alongside some bigger feature request, but for now I'll leave things as they are

This issue will join the graveyard of open issues to act as future documentation for others that may request the same

Thanks again for using the plugin and your feedback, this is the exact type of feature request I enjoy actioning (even though it was unsuccessful in this case)

takatalvi commented 8 months ago

Understood, thank you as well. It's always a pleasure with a developer who's interested in the users' feedback :)