OpenInv Conflict
pookshuman opened this issue · 16 comments
Hello,
I use a plugin called OpenInv which allows me to open chests and edit the contents without anyone knowing. This worked very well until VNP added the silentchest no edit feature.
Can you add a permission which allows players to edit chests while vanished? It would make my life a lot easier, thank you :)
Pretty much, if you don't want silent chest opening, don't give yourself the permission or toggle it off with that command.
Thank you for the comments, but I don't think I made myself clear. /v t chests doesn't solve the issue.
What I want is silent chest opening AND the ability to edit the contents.
The way it is now, I have to choose between silent chest opening OR editing the chest contents. It was not always this way and i am just requesting that it go back the way it was.
Thank you for the comments, but I don't think I made myself clear. /v t
chests doesn't solve the issue.
What I want is silent chest opening AND the ability to edit the contents.
The way it is now, I have to choose between silent chest opening OR editing
the chest contents. It was not always this way and i am just requesting
that it go back the way it was.
On Tue, Aug 14, 2012 at 2:50 PM, Ammar Askar [email protected]:
Pretty much, if you don't want silent chest opening, don't give yourself
the permission or toggle it off with that command.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/257#issuecomment-7736121.
Editing chests while vanished would be horrible to implement, we'd have to use reflection or depend on a significant amount of craftbukkit methods, all of which can and will break through updates. If OpenInv isn't working when you disable silent chests and no interact then something is wrong with that plugin.
@ammaraskar Really... Editing chests in vanish mode would be as simple as removing this block of code.
https://github.com/mbax/VanishNoPacket/blob/master/src/org/kitteh/vanish/listeners/ListenInventory.java#L20
And that is how I initially planned it out, but consider this, when you open a chest silently you open a virtual copy of the chest because calling openInventory the chest's inventory causes the chest lid to pop up. Now you could overwrite the chest by the virtual copy when the user closes the virtual inventory but that would cause issues with duplication and people's changes being written over, myriad issues. Hence I decided to go with the safe path and make it so that the inventories were uneditable.
No, when you make a duplicate chest, the items in the chest is passed by reference, which means that all edits are sent across.
Indeed it does, thats why you need to toggle it off to avoid the conflict, I'll consult with @mbax about the detection and usage of OpenInv later.
Or you could just let people install OpenInv, which handles silent chest very well.
getContents() returns a copy of the ItemStacks, https://github.com/Bukkit/CraftBukkit/blob/master/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java#L53
see the
new CraftItemStack(mcItems[i])
bit?
Thats great, people can use OpenInv with this plugin, there isn't a conflict with OpenInv if you have the nointeract and chests toggles switched off.
Could you implement a check for OpenInv and let OpenInv handle the silent chest opening if installed?
(OpenInv silentchest code here: https://github.com/lishd/OpenInv/blob/master/src/lishid/openinv/OpenInvPlayerListener.java#L84)