BlockProt

BlockProt

17.2k Downloads

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

TheDiscordian opened this issue ยท 1 comments

commented

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.

commented

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

/**
* Set a new list of FriendHandler for the friends list.
*/
public void setFriends(@NotNull final List<FriendHandler> friends) {
container.removeKey(friendNbtKey);
friends.forEach(this::addFriend);
}

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.