mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-23 16:41:42 +01:00
Fix for Island team kick requires confirmation when using GUI #2311
This commit is contained in:
parent
7d52325196
commit
19d81c70c6
@ -557,7 +557,7 @@ public class IslandTeamCommand extends CompositeCommand {
|
|||||||
case RanksManager.TRUSTED_RANK -> this.unTrustCommand.unTrustCmd(user, member.getUniqueId());
|
case RanksManager.TRUSTED_RANK -> this.unTrustCommand.unTrustCmd(user, member.getUniqueId());
|
||||||
default -> {
|
default -> {
|
||||||
if (kickCommand.canExecute(user, kickCommand.getLabel(), List.of(member.getName()))) {
|
if (kickCommand.canExecute(user, kickCommand.getLabel(), List.of(member.getName()))) {
|
||||||
yield kickCommand.execute(user, kickCommand.getLabel(), List.of(member.getName()));
|
yield kickCommand.kick(clicker, member.getUniqueId());
|
||||||
} else {
|
} else {
|
||||||
yield false;
|
yield false;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,10 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void kick(User user, UUID targetUUID) {
|
protected boolean kick(User user, UUID targetUUID) {
|
||||||
|
if (targetUUID == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
User target = User.getInstance(targetUUID);
|
User target = User.getInstance(targetUUID);
|
||||||
Island oldIsland = Objects.requireNonNull(getIslands().getIsland(getWorld(), targetUUID)); // Should never be
|
Island oldIsland = Objects.requireNonNull(getIslands().getIsland(getWorld(), targetUUID)); // Should never be
|
||||||
// null because of
|
// null because of
|
||||||
@ -99,7 +102,7 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
|
|||||||
IslandBaseEvent event = TeamEvent.builder().island(oldIsland).reason(TeamEvent.Reason.KICK)
|
IslandBaseEvent event = TeamEvent.builder().island(oldIsland).reason(TeamEvent.Reason.KICK)
|
||||||
.involvedPlayer(targetUUID).build();
|
.involvedPlayer(targetUUID).build();
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
target.sendMessage("commands.island.team.kick.player-kicked", TextVariables.GAMEMODE,
|
target.sendMessage("commands.island.team.kick.player-kicked", TextVariables.GAMEMODE,
|
||||||
getAddon().getDescription().getName(), TextVariables.NAME, user.getName(), TextVariables.DISPLAY_NAME,
|
getAddon().getDescription().getName(), TextVariables.NAME, user.getName(), TextVariables.DISPLAY_NAME,
|
||||||
@ -121,6 +124,7 @@ public class IslandTeamKickCommand extends ConfirmableCommand {
|
|||||||
getParent().getSubCommand("invite").ifPresent(c -> c.setCooldown(oldIsland.getUniqueId(),
|
getParent().getSubCommand("invite").ifPresent(c -> c.setCooldown(oldIsland.getUniqueId(),
|
||||||
targetUUID.toString(), getSettings().getInviteCooldown() * 60));
|
targetUUID.toString(), getSettings().getInviteCooldown() * 60));
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user