Vanish No Packet

Vanish No Packet

855k Downloads

OpenInv Conflict

pookshuman opened this issue · 16 comments

commented

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 :)

commented

/v t chests
That should fix the problem for you.

commented

Pretty much, if you don't want silent chest opening, don't give yourself the permission or toggle it off with that command.

commented

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.

commented

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.

commented

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.

commented

@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

commented

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.

commented

No, when you make a duplicate chest, the items in the chest is passed by reference, which means that all edits are sent across.

commented

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.

commented

Or you could just let people install OpenInv, which handles silent chest very well.

commented

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?

commented

Ah, you're using Bukkit stuff.

commented

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.

commented

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)

commented

nointeract sets the event to cancelled.

commented

OpenInv can also now add a VNP hook, as other plugins can write hooks that register on detecting it. I'm on vacation currently, but can look into it when I'm back.