From 9b4bbf9ca43f5b130564e9b294a7e0467f3835ed Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 3 Aug 2024 15:39:08 +0200 Subject: [PATCH] Update EventCommand and EventRescheduleCommand --- CommonCore | 2 +- .../steamwar/velocitycore/commands/EventCommand.java | 11 ++++------- .../velocitycore/commands/EventRescheduleCommand.java | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/CommonCore b/CommonCore index d000b86..c702acb 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit d000b8687d93eb43520bbf6685281099055eab9f +Subproject commit c702acb9d869c74d2d2da449e95b37e4c3c4fc22 diff --git a/src/de/steamwar/velocitycore/commands/EventCommand.java b/src/de/steamwar/velocitycore/commands/EventCommand.java index 98c5a40..dee1a8d 100644 --- a/src/de/steamwar/velocitycore/commands/EventCommand.java +++ b/src/de/steamwar/velocitycore/commands/EventCommand.java @@ -33,10 +33,7 @@ import de.steamwar.velocitycore.SubserverSystem; import java.sql.Timestamp; import java.time.Instant; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; public class EventCommand extends SWCommand { @@ -91,7 +88,7 @@ public class EventCommand extends SWCommand { 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())); - if (fight.hasFinished() || fight.getErgebnis() != 0) { + if (fight.hasFinished()) { switch (fight.getErgebnis()) { case 1: fline.append(sender.parseToLegacy("EVENT_CURRENT_FIGHT_WIN", blue.getTeamColor(), blue.getTeamKuerzel())); @@ -133,10 +130,10 @@ public class EventCommand extends SWCommand { @Override public Collection tabCompletes(Chatter sender, PreviousArguments previousArguments, String s) { - List teams = new ArrayList<>(); + Set teams = new HashSet<>(); Event currentEvent = Event.get(); 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; Team red = Team.get(fight.getTeamRed()); teams.add(red.getTeamName()); diff --git a/src/de/steamwar/velocitycore/commands/EventRescheduleCommand.java b/src/de/steamwar/velocitycore/commands/EventRescheduleCommand.java index 0f27954..ad2a3da 100644 --- a/src/de/steamwar/velocitycore/commands/EventRescheduleCommand.java +++ b/src/de/steamwar/velocitycore/commands/EventRescheduleCommand.java @@ -81,9 +81,9 @@ public class EventRescheduleCommand extends SWCommand { if(currentEvent == null){ return null; } - List teams = new ArrayList<>(); + Set teams = new HashSet<>(); 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)); teams.add(team.getTeamName()); teams.add(team.getTeamKuerzel());