geforkt von SteamWar/BungeeCore
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:
Commit
d67c9bac66
@ -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()));
|
||||||
|
@ -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;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren