Archiviert
1
0

Merge pull request 'Show eventfights as finished immediatly' (#340) from instantEventend into master

Reviewed-on: SteamWar/BungeeCore#340
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Lixfel 2022-04-09 21:06:56 +02:00
Commit d67c9bac66
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.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<EventFight> 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()));

Datei anzeigen

@ -45,6 +45,7 @@ public class EventFight implements Comparable<EventFight> {
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<EventFight> {
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<EventFight> {
return ergebnis;
}
public boolean hasFinished() {
return fight != 0;
}
@Override
public int hashCode(){
return fightID;