From eb8a8a2e07d9ef3f5665b0af836f9159beb81586 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 9 Apr 2022 16:58:51 +0200 Subject: [PATCH] Show eventfights as finished immediatly Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/EventCommand.java | 4 +--- src/de/steamwar/bungeecore/sql/EventFight.java | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index 79ae6208..c6ed4484 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -29,7 +29,6 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import java.time.Instant; import java.time.format.DateTimeFormatter; -import java.time.temporal.ChronoUnit; import java.util.List; import java.util.Set; @@ -100,7 +99,6 @@ public class EventCommand extends BasicCommand { Message.send("EVENT_USAGE", player); List fights = EventFight.getEvent(currentEvent.getEventID()); - Instant now = Instant.now(); Message.send("EVENT_CURRENT_EVENT", player, currentEvent.getEventName()); @@ -111,7 +109,7 @@ public class EventCommand extends BasicCommand { StringBuilder fline = new StringBuilder(Message.parse("EVENT_CURRENT_FIGHT", player, fight.getStartTime().toLocalDateTime().format(timeFormat), blue.getTeamColor(), blue.getTeamKuerzel(), red.getTeamColor(), red.getTeamKuerzel())); - if(now.isAfter(fight.getStartTime().toInstant().plus(35, ChronoUnit.MINUTES))){ + if(fight.hasFinished()){ switch(fight.getErgebnis()){ case 1: fline.append(Message.parse("EVENT_CURRENT_FIGHT_WIN", player, blue.getTeamColor(), blue.getTeamKuerzel())); diff --git a/src/de/steamwar/bungeecore/sql/EventFight.java b/src/de/steamwar/bungeecore/sql/EventFight.java index ffcbe6f8..4135b61f 100644 --- a/src/de/steamwar/bungeecore/sql/EventFight.java +++ b/src/de/steamwar/bungeecore/sql/EventFight.java @@ -45,6 +45,7 @@ public class EventFight implements Comparable { private final int teamRed; private final int kampfleiter; private final int ergebnis; + private final int fight; private EventFight(ResultSet rs) throws SQLException { eventID = rs.getInt("EventID"); @@ -56,6 +57,7 @@ public class EventFight implements Comparable { teamRed = rs.getInt("TeamRed"); kampfleiter = rs.getInt("Kampfleiter"); ergebnis = rs.getInt("Ergebnis"); + fight = rs.getInt("Fight"); } public void reschedule(){ @@ -122,6 +124,10 @@ public class EventFight implements Comparable { return ergebnis; } + public boolean hasFinished() { + return fight != 0; + } + @Override public int hashCode(){ return fightID;