SteamWar/BungeeCore
Archiviert
13
2

Update EventCommand and EventRescheduleCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2024-08-03 15:39:08 +02:00
Ursprung c4cabdcdb6
Commit 9b4bbf9ca4
3 geänderte Dateien mit 7 neuen und 10 gelöschten Zeilen

@ -1 +1 @@
Subproject commit d000b8687d93eb43520bbf6685281099055eab9f Subproject commit c702acb9d869c74d2d2da449e95b37e4c3c4fc22

Datei anzeigen

@ -33,10 +33,7 @@ import de.steamwar.velocitycore.SubserverSystem;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.Instant; import java.time.Instant;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.*;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class EventCommand extends SWCommand { public class EventCommand extends SWCommand {
@ -91,7 +88,7 @@ public class EventCommand extends SWCommand {
Team red = Team.get(fight.getTeamRed()); Team red = Team.get(fight.getTeamRed());
StringBuilder fline = new StringBuilder(sender.parseToLegacy("EVENT_CURRENT_FIGHT", fight.getStartTime().toLocalDateTime().format(format), blue.getTeamColor(), blue.getTeamKuerzel(), red.getTeamColor(), red.getTeamKuerzel())); StringBuilder fline = new StringBuilder(sender.parseToLegacy("EVENT_CURRENT_FIGHT", fight.getStartTime().toLocalDateTime().format(format), blue.getTeamColor(), blue.getTeamKuerzel(), red.getTeamColor(), red.getTeamKuerzel()));
if (fight.hasFinished() || fight.getErgebnis() != 0) { if (fight.hasFinished()) {
switch (fight.getErgebnis()) { switch (fight.getErgebnis()) {
case 1: case 1:
fline.append(sender.parseToLegacy("EVENT_CURRENT_FIGHT_WIN", blue.getTeamColor(), blue.getTeamKuerzel())); fline.append(sender.parseToLegacy("EVENT_CURRENT_FIGHT_WIN", blue.getTeamColor(), blue.getTeamKuerzel()));
@ -133,10 +130,10 @@ public class EventCommand extends SWCommand {
@Override @Override
public Collection<String> tabCompletes(Chatter sender, PreviousArguments previousArguments, String s) { public Collection<String> tabCompletes(Chatter sender, PreviousArguments previousArguments, String s) {
List<String> teams = new ArrayList<>(); Set<String> teams = new HashSet<>();
Event currentEvent = Event.get(); Event currentEvent = Event.get();
for (EventFight fight : EventFight.getEvent(currentEvent.getEventID())) { for (EventFight fight : EventFight.getEvent(currentEvent.getEventID())) {
if (fight.hasFinished() || fight.getErgebnis() != 0) continue; if (fight.hasFinished()) continue;
if (fight.getStartTime().after(new Timestamp(System.currentTimeMillis()))) continue; if (fight.getStartTime().after(new Timestamp(System.currentTimeMillis()))) continue;
Team red = Team.get(fight.getTeamRed()); Team red = Team.get(fight.getTeamRed());
teams.add(red.getTeamName()); teams.add(red.getTeamName());

Datei anzeigen

@ -81,9 +81,9 @@ public class EventRescheduleCommand extends SWCommand {
if(currentEvent == null){ if(currentEvent == null){
return null; return null;
} }
List<String> teams = new ArrayList<>(); Set<String> teams = new HashSet<>();
for (EventFight fight : EventFight.getEvent(currentEvent.getEventID())) { for (EventFight fight : EventFight.getEvent(currentEvent.getEventID())) {
if (fight.hasFinished() || fight.getErgebnis() != 0) continue; if (fight.hasFinished()) continue;
Team team = Team.get(teamMapper.apply(fight)); Team team = Team.get(teamMapper.apply(fight));
teams.add(team.getTeamName()); teams.add(team.getTeamName());
teams.add(team.getTeamKuerzel()); teams.add(team.getTeamKuerzel());