geforkt von SteamWar/BungeeCore
Fix team leader stepdown and leaving
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
3980961b76
Commit
b35d5e214a
@ -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){
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren