SteamWar/BungeeCore
Archiviert
13
2

Show eventfights as finished immediatly
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-04-09 16:58:51 +02:00
Ursprung 1bc5011d4f
Commit eb8a8a2e07
2 geänderte Dateien mit 7 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -29,7 +29,6 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.time.Instant; import java.time.Instant;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -100,7 +99,6 @@ public class EventCommand extends BasicCommand {
Message.send("EVENT_USAGE", player); Message.send("EVENT_USAGE", player);
List<EventFight> fights = EventFight.getEvent(currentEvent.getEventID()); List<EventFight> fights = EventFight.getEvent(currentEvent.getEventID());
Instant now = Instant.now();
Message.send("EVENT_CURRENT_EVENT", player, currentEvent.getEventName()); 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(), StringBuilder fline = new StringBuilder(Message.parse("EVENT_CURRENT_FIGHT", player, fight.getStartTime().toLocalDateTime().format(timeFormat), blue.getTeamColor(), blue.getTeamKuerzel(),
red.getTeamColor(), red.getTeamKuerzel())); red.getTeamColor(), red.getTeamKuerzel()));
if(now.isAfter(fight.getStartTime().toInstant().plus(35, ChronoUnit.MINUTES))){ if(fight.hasFinished()){
switch(fight.getErgebnis()){ switch(fight.getErgebnis()){
case 1: case 1:
fline.append(Message.parse("EVENT_CURRENT_FIGHT_WIN", player, blue.getTeamColor(), blue.getTeamKuerzel())); fline.append(Message.parse("EVENT_CURRENT_FIGHT_WIN", player, blue.getTeamColor(), blue.getTeamKuerzel()));

Datei anzeigen

@ -45,6 +45,7 @@ public class EventFight implements Comparable<EventFight> {
private final int teamRed; private final int teamRed;
private final int kampfleiter; private final int kampfleiter;
private final int ergebnis; private final int ergebnis;
private final int fight;
private EventFight(ResultSet rs) throws SQLException { private EventFight(ResultSet rs) throws SQLException {
eventID = rs.getInt("EventID"); eventID = rs.getInt("EventID");
@ -56,6 +57,7 @@ public class EventFight implements Comparable<EventFight> {
teamRed = rs.getInt("TeamRed"); teamRed = rs.getInt("TeamRed");
kampfleiter = rs.getInt("Kampfleiter"); kampfleiter = rs.getInt("Kampfleiter");
ergebnis = rs.getInt("Ergebnis"); ergebnis = rs.getInt("Ergebnis");
fight = rs.getInt("Fight");
} }
public void reschedule(){ public void reschedule(){
@ -122,6 +124,10 @@ public class EventFight implements Comparable<EventFight> {
return ergebnis; return ergebnis;
} }
public boolean hasFinished() {
return fight != 0;
}
@Override @Override
public int hashCode(){ public int hashCode(){
return fightID; return fightID;