spnda / BlockProt

Bukkit plugin to protect your chests, furnaces and more with a modern GUI approach.
https://www.spigotmc.org/resources/blockprot.87829/
GNU General Public License v3.0
37 stars 14 forks source link

[Feature]: Removed old friends when copy/pasting configuration #268

Open TheDiscordian opened 8 months ago

TheDiscordian commented 8 months ago

Feature description

Currently when copying a configuration from one locked block to another new friends are appended, but old ones are not removed. For updating all the boxes in a building, it'd be much nicer if the old friends were also removed (the behaviour I expected).

Unsure if this should be a configurable setting, or the behaviour simply changed.

spnda commented 8 months ago

Hmm, reading the code this is actually what's supposed to happen.

https://github.com/spnda/BlockProt/blob/a2dc550f1900caaaf6474a3bc2fb2e87522ddab3/spigot/src/main/java/de/sean/blockprot/bukkit/nbt/FriendSupportingHandler.java#L109-L115

I've talked to the author of NBT-API and he says this seems like wrong behavior. I think the code will have to be refactored a bit and perhaps that could fix it again? I'll do some tests tomorrow and see if I can fix this.