Archiviert
1
0

Merge pull request 'Fix team leader stepdown and leaving' (#481) from teamDisband into master

Reviewed-on: SteamWar/BungeeCore#481
Reviewed-by: Chaoscaot <chaoscaot@zohomail.eu>
Dieser Commit ist enthalten in:
Lixfel 2023-08-25 17:26:24 +02:00
Commit 4db2ba6a5d

Datei anzeigen

@ -188,7 +188,7 @@ public class TeamCommand extends SWCommand {
if(notLeader(player, user))
return;
if(team.size() > 1 && team.getMembers().stream().map(SteamwarUser::get).filter(member -> user != member).noneMatch(SteamwarUser::isLeader)){
if(noRemainingLeaders(team, user)){
Message.send("TEAM_OTHER_LEADER_REQUIRED", player);
return;
}
@ -205,7 +205,7 @@ public class TeamCommand extends SWCommand {
return;
int teamSize = team.size();
if(teamSize > 1 && user.isLeader() && team.getMembers().stream().map(SteamwarUser::get).filter(member -> user != member).noneMatch(SteamwarUser::isLeader)){
if(teamSize > 1 && user.isLeader() && noRemainingLeaders(team, user)) {
Message.send("TEAM_OTHER_LEADER_REQUIRED", player);
return;
}
@ -219,6 +219,10 @@ public class TeamCommand extends SWCommand {
Message.send("TEAM_LEAVE_LEFT", player);
}
private boolean noRemainingLeaders(Team team, SteamwarUser except) {
return SteamwarUser.getTeam(team.getTeamId()).stream().filter(member -> except.getId() != member.getId()).noneMatch(SteamwarUser::isLeader);
}
@Register(value = "invite", description = "TEAM_INVITE_USAGE")
public void invite(ProxiedPlayer player, String toInvite){