SteamWar/BungeeCore
Archiviert
13
2

Add user count to team info command
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
yoyosource 2023-07-18 22:09:17 +02:00
Ursprung 3254755e61
Commit 6192d0d458
3 geänderte Dateien mit 28 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -23,15 +23,11 @@ import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Storage; import de.steamwar.bungeecore.Storage;
import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWItem;
import de.steamwar.bungeecore.inventory.SWListInv; import de.steamwar.bungeecore.inventory.SWListInv;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.Team;
import de.steamwar.sql.TeamTeilnahme;
import de.steamwar.command.PreviousArguments; import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper; import de.steamwar.command.TypeMapper;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import de.steamwar.sql.Event; import de.steamwar.sql.*;
import net.md_5.bungee.BungeeCord; import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
@ -181,6 +177,7 @@ public class TeamCommand extends SWCommand {
} }
user.setTeam(t); user.setTeam(t);
if (user.isPunished(Punishment.PunishmentType.NoTeamEventParticipation)) removeTeamTeilnahme(t);
teamInvitations.remove(user.getId()); teamInvitations.remove(user.getId());
Message.send("TEAM_JOIN_JOINED", player, Team.get(t).getTeamName()); Message.send("TEAM_JOIN_JOINED", player, Team.get(t).getTeamName());
} }
@ -251,6 +248,10 @@ public class TeamCommand extends SWCommand {
return; return;
} }
if (target.isPunished(Punishment.PunishmentType.NoTeamEventParticipation)) {
Message.send("UNNOTEAMEVENTPARTICIPATION_NOTICE", player);
}
teamInvitations.get(target.getId()).add(team.getTeamId()); teamInvitations.get(target.getId()).add(team.getTeamId());
Message.send("TEAM_INVITE_INVITED", player, toInvite); Message.send("TEAM_INVITE_INVITED", player, toInvite);
@ -383,12 +384,12 @@ public class TeamCommand extends SWCommand {
List<SteamwarUser> users = team.getMembers().stream().map(SteamwarUser::get).collect(Collectors.toList()); List<SteamwarUser> users = team.getMembers().stream().map(SteamwarUser::get).collect(Collectors.toList());
Message.sendPrefixless("TEAM_INFO_LEADER", player, getMemberList(users, true)); Message.sendPrefixless("TEAM_INFO_LEADER", player, users.stream().filter(SteamwarUser::isLeader).count(), getMemberList(users, true));
String members = getMemberList(users, false); String members = getMemberList(users, false);
if(members.length() > 0) { if(members.length() > 0) {
Message.sendPrefixless("TEAM_INFO_MEMBER", player, members); Message.sendPrefixless("TEAM_INFO_MEMBER", player, users.stream().filter(u -> !u.isLeader()).count(), members);
} }
Set<Event> events = TeamTeilnahme.getEvents(team.getTeamId()); Set<Event> events = TeamTeilnahme.getEvents(team.getTeamId());
@ -486,6 +487,10 @@ public class TeamCommand extends SWCommand {
TeamTeilnahme.notTeilnehmen(team.getTeamId(), event.getEventID()); TeamTeilnahme.notTeilnehmen(team.getTeamId(), event.getEventID());
Message.send("TEAM_EVENT_LEFT", player); Message.send("TEAM_EVENT_LEFT", player);
}else{ }else{
if (checkNoEventPunished(team.getTeamId())) {
Message.send("UNNOTEAMEVENTPARTICIPATION_MESSAGE", player);
return;
}
TeamTeilnahme.teilnehmen(team.getTeamId(), event.getEventID()); TeamTeilnahme.teilnehmen(team.getTeamId(), event.getEventID());
Message.send("TEAM_EVENT_JOINED", player, event.getEventName()); Message.send("TEAM_EVENT_JOINED", player, event.getEventName());
Message.sendPrefixless("TEAM_EVENT_HOW_TO_LEAVE", player); Message.sendPrefixless("TEAM_EVENT_HOW_TO_LEAVE", player);
@ -690,4 +695,16 @@ public class TeamCommand extends SWCommand {
} }
return false; return false;
} }
public static void removeTeamTeilnahme(int team) {
Event.getComing()
.stream()
.filter(event -> TeamTeilnahme.nimmtTeil(team, event.getEventID()))
.forEach(event -> TeamTeilnahme.notTeilnehmen(team, event.getEventID()));
}
public static boolean checkNoEventPunished(int team) {
return SteamwarUser.getTeam(team).stream()
.anyMatch(steamwarUser -> steamwarUser.isPunished(Punishment.PunishmentType.NoTeamEventParticipation));
}
} }

Datei anzeigen

@ -466,8 +466,8 @@ TEAM_LEADER_PROMOTED=§7You made §e{0} §7a leader!
#Team Info #Team Info
TEAM_INFO_USAGE=§8/§7team info §8[§eTeamname§8] TEAM_INFO_USAGE=§8/§7team info §8[§eTeamname§8]
TEAM_INFO_TEAM=§7Team §e{0} §8[§{1}{2}§8] TEAM_INFO_TEAM=§7Team §e{0} §8[§{1}{2}§8]
TEAM_INFO_LEADER=§7Leader§8: {0} TEAM_INFO_LEADER=§7Leader ({0})§8: {1}
TEAM_INFO_MEMBER=§7Member§8: {0} TEAM_INFO_MEMBER=§7Member ({0})§8: {1}
TEAM_INFO_EVENTS=§7Events§8: §e{0} TEAM_INFO_EVENTS=§7Events§8: §e{0}
#Team List #Team List

Datei anzeigen

@ -444,8 +444,8 @@ TEAM_LEADER_PROMOTED=§7Du hast den Spieler §e{0} §7zum Leader gemacht!
#Team Info #Team Info
TEAM_INFO_USAGE=§8/§7team info §8[§eTeamname§8] TEAM_INFO_USAGE=§8/§7team info §8[§eTeamname§8]
TEAM_INFO_TEAM=§7Team §e{0} §8[§{1}{2}§8] TEAM_INFO_TEAM=§7Team §e{0} §8[§{1}{2}§8]
TEAM_INFO_LEADER=§7Leader§8: {0} TEAM_INFO_LEADER=§7Leader ({0})§8: {1}
TEAM_INFO_MEMBER=§7Member§8: {0} TEAM_INFO_MEMBER=§7Member ({0})§8: {1}
TEAM_INFO_EVENTS=§7Events§8: §e{0} TEAM_INFO_EVENTS=§7Events§8: §e{0}
#Team List #Team List