mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-26 10:01:41 +01:00
Fix admin commands to avoid removing players from more than one island
This commit is contained in:
parent
631a15563d
commit
0a9da71c65
@ -65,8 +65,8 @@ public class AdminSetspawnCommand extends ConfirmableCommand {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
// If island is owned, then unregister the owner and any members
|
// If island is owned, then unregister the owner and any members
|
||||||
new ImmutableSet.Builder<UUID>().addAll(i.getMembers().keySet()).build().forEach(m ->
|
new ImmutableSet.Builder<UUID>().addAll(i.getMembers().keySet()).build()
|
||||||
getIslands().removePlayer(getWorld(), m));
|
.forEach(m -> getIslands().removePlayer(i, m));
|
||||||
}
|
}
|
||||||
getIslands().setSpawn(i);
|
getIslands().setSpawn(i);
|
||||||
i.setSpawnPoint(World.Environment.NORMAL, user.getLocation());
|
i.setSpawnPoint(World.Environment.NORMAL, user.getLocation());
|
||||||
|
@ -71,7 +71,7 @@ public class AdminTeamKickCommand extends CompositeCommand {
|
|||||||
User target = User.getInstance(targetUUID);
|
User target = User.getInstance(targetUUID);
|
||||||
target.sendMessage("commands.admin.team.kick.admin-kicked");
|
target.sendMessage("commands.admin.team.kick.admin-kicked");
|
||||||
|
|
||||||
getIslands().removePlayer(getWorld(), targetUUID);
|
getIslands().removePlayer(island, targetUUID);
|
||||||
user.sendMessage("commands.admin.team.kick.success", TextVariables.NAME, target.getName(), "[owner]", getPlayers().getName(island.getOwner()));
|
user.sendMessage("commands.admin.team.kick.success", TextVariables.NAME, target.getName(), "[owner]", getPlayers().getName(island.getOwner()));
|
||||||
|
|
||||||
// Fire event so add-ons know
|
// Fire event so add-ons know
|
||||||
|
@ -156,7 +156,7 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
|
|||||||
user.sendMessage("commands.island.team.invite.errors.island-is-full");
|
user.sendMessage("commands.island.team.invite.errors.island-is-full");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Remove player as owner of the old island
|
// Remove the player's other islands
|
||||||
getIslands().removePlayer(getWorld(), user.getUniqueId());
|
getIslands().removePlayer(getWorld(), user.getUniqueId());
|
||||||
// Remove money inventory etc. for leaving
|
// Remove money inventory etc. for leaving
|
||||||
cleanPlayer(user);
|
cleanPlayer(user);
|
||||||
|
@ -714,7 +714,7 @@ commands:
|
|||||||
name-has-invited-you: '&a [name] has invited you to join their island.'
|
name-has-invited-you: '&a [name] has invited you to join their island.'
|
||||||
to-accept-or-reject: '&a Do /[label] team accept to accept, or /[label] team
|
to-accept-or-reject: '&a Do /[label] team accept to accept, or /[label] team
|
||||||
reject to reject'
|
reject to reject'
|
||||||
you-will-lose-your-island: '&c WARNING! You will lose your island if you accept!'
|
you-will-lose-your-island: '&c WARNING! You will lose all your islands if you accept!'
|
||||||
gui:
|
gui:
|
||||||
titles:
|
titles:
|
||||||
team-invite-panel: "Invite Players"
|
team-invite-panel: "Invite Players"
|
||||||
@ -757,7 +757,7 @@ commands:
|
|||||||
name-joined-your-island: '&a [name] joined your island!'
|
name-joined-your-island: '&a [name] joined your island!'
|
||||||
confirmation: |-
|
confirmation: |-
|
||||||
&c Are you sure you want to accept this invite?
|
&c Are you sure you want to accept this invite?
|
||||||
&c&l You will &n LOSE &r&c&l your current island!
|
&c&l You will &n LOSE ALL &r&c&l your islands!
|
||||||
reject:
|
reject:
|
||||||
description: reject an invitation
|
description: reject an invitation
|
||||||
you-rejected-invite: '&a You rejected the invitation to join an island.'
|
you-rejected-invite: '&a You rejected the invitation to join an island.'
|
||||||
|
@ -210,7 +210,7 @@ public class AdminTeamKickCommandTest {
|
|||||||
AdminTeamKickCommand itl = new AdminTeamKickCommand(ac);
|
AdminTeamKickCommand itl = new AdminTeamKickCommand(ac);
|
||||||
assertTrue(itl.canExecute(user, itl.getLabel(), Collections.singletonList(name)));
|
assertTrue(itl.canExecute(user, itl.getLabel(), Collections.singletonList(name)));
|
||||||
assertTrue(itl.execute(user, itl.getLabel(), Collections.singletonList(name)));
|
assertTrue(itl.execute(user, itl.getLabel(), Collections.singletonList(name)));
|
||||||
verify(im).removePlayer(eq(world), eq(notUUID));
|
verify(im).removePlayer(is, notUUID);
|
||||||
verify(user).sendMessage(eq("commands.admin.team.kick.success"), eq(TextVariables.NAME), eq(name), eq("[owner]"), anyString());
|
verify(user).sendMessage(eq("commands.admin.team.kick.success"), eq(TextVariables.NAME), eq(name), eq("[owner]"), anyString());
|
||||||
// Offline so event will be called 4 times
|
// Offline so event will be called 4 times
|
||||||
verify(pim, times(4)).callEvent(any());
|
verify(pim, times(4)).callEvent(any());
|
||||||
|
Loading…
Reference in New Issue
Block a user