geforkt von SteamWar/BungeeCore
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:
Commit
4db2ba6a5d
@ -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