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))
|
if(notLeader(player, user))
|
||||||
return;
|
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);
|
Message.send("TEAM_OTHER_LEADER_REQUIRED", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ public class TeamCommand extends SWCommand {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int teamSize = team.size();
|
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);
|
Message.send("TEAM_OTHER_LEADER_REQUIRED", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -219,6 +219,10 @@ public class TeamCommand extends SWCommand {
|
|||||||
Message.send("TEAM_LEAVE_LEFT", player);
|
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")
|
@Register(value = "invite", description = "TEAM_INVITE_USAGE")
|
||||||
public void invite(ProxiedPlayer player, String toInvite){
|
public void invite(ProxiedPlayer player, String toInvite){
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren