Description
Island owners inventory gets resetted when member is kicked out of the team.
Steps to reproduce the behavior:
on-join:
money: false
inventory: true
ender-chest: false
on-leave:
money: false
inventory: true
ender-chest: true
Expected behavior
Only the members that join/leave/get kicked shall be affected with the configuration above, and not owners.
Server Information:
OS:
Debian GNU/Linux 9
Java Version:
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
Localhost:
Thanks for your report, but this is a BentoBox bug! I'll move the issue :wink:
Okay, I can confirm it's occuring - no need to test it on a fresh install:
https://github.com/BentoBoxWorld/BentoBox/blob/f71ca4f0847593dad1cc751a96a3c2b6a298d267/src/main/java/world/bentobox/bentobox/api/commands/island/team/IslandTeamKickCommand.java#L74-L80
The user shouldn't be used there - it should be the target.
I just fixed the bug - at least the island owner's no longer losing his stuff. However, the member that gets kicked does not get his inventory/enderchest resetted if he's offline at that moment.
@tastybento Could you please have a look at that? I've also @Ignore'd the unit test responsible for checking this. That's pointless to rewrite it as long as we do not have the final solution to this problem.
I'll keep this issue opened so we can monitor it. I'm also assigning you to it if you don't mind, tasty.
@Poslovitch To be able to remove items from the offline player will take some handling. We will need to track in the database a list of offline kicked players and then when they log back in, remove their stuff when they are in the appropriate game world. I'm concerned about edge cases and race conditions. We'll have to think them through. For example:
Standard path
Alternatives
or
Any others?
We'll need to assume that the Admin is running a per-world inventory system.
There are always an ability to use NMS to modify offline player inventories :)
NMS is not an option. That's a hassle to maintain.