Skip to content

Conversation

@Kawi16
Copy link

@Kawi16 Kawi16 commented Dec 26, 2025

This fix allows third-party plugins to temporarily enable a user to open containers silently using OpenInv API.
The permission check is unnecessary because silent mode is disabled by default, and enabling it via command requires a permission.

An example:
I want staff members to be able to open containers silently only while in vanish, so via the API I add the staff member to the list as soon as they enter vanish.
Previously, with the permission check in place, the shulker box would bug out: the animation would start and, once closed, it would remain open.
Now, with this change, the staff member can open the shulker silently while in vanish and, once they exit vanish mode, they will no longer be able to do so.

This fix allows third-party plugins to temporarily enable a user to open containers silently (for example, for use in vanish plugins) using OpenInv API.
The permission check is unnecessary because silent mode is disabled by default, and enabling it via command requires a permission.
Copy link
Owner

@Jikoo Jikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly true - the permission check guards against permission changes after enabling the toggles. OI did drop the behavior of toggles persisting across restarts, but it does offer an addon that re-enables the behavior.

I don't mind this being changed (a lot of time permission changes require the player to rejoin anyway, and I would hope that demotions are rare), but we should be consistent and allow AnyContainer as well, plus modify the toggle API and existing addon to not persist toggles on join for players lacking permission.

/e: You could also just add a temp PermissionAttachment to the user while your plugin's mode is active, removing the need for the change and keeping the previous behavior.

@Jikoo Jikoo changed the title Fix silent logic Allow addons to enable SilentContainer without permission Dec 26, 2025
@Kawi16
Copy link
Author

Kawi16 commented Dec 27, 2025

You’re absolutely right - I had forgotten about permission removal, probably because I’m used to the fact that users are generally kicked/banned before or after that anyway.
I had also thought about using PermissionAttachment, but I discovered the bug while using another plugin that isn’t mine, so I figured it would be better to fix the issue at the root.

That said, I was thinking that another option could be to modify the set method in the API by passing a “cause” for the toggle change. If the cause is API, OpenInv would skip the permission check and leave everything to be handled by the developer of the other plugin; if instead the cause is PLUGIN, OpenInv would manage the toggle exactly as it did before.
This way, neither OpenInv’s current consistency nor the addon you mentioned would be broken.

To avoid issues with plugins that already use the API, if the cause isn’t specified, the set method would default it to PLUGIN.

I’m not sure whether this is a good idea or not, so I’m looking forward to your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants