Archiviert
1
0

Merge pull request 'Event deadline' (#188) from event-deadline into master

Reviewed-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Lixfel 2021-03-01 21:05:15 +01:00
Commit 2368953e23
4 geänderte Dateien mit 12 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -78,12 +78,16 @@ public class EventCommand extends BasicCommand {
private void noCurrentEvent(ProxiedPlayer player){ private void noCurrentEvent(ProxiedPlayer player){
Message.send("EVENT_NO_CURRENT", player); Message.send("EVENT_NO_CURRENT", player);
List<Event> coming = Event.getComing(); List<Event> coming = Event.getComing();
Instant now = Instant.now();
if(!coming.isEmpty()){ if(!coming.isEmpty()){
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern(Message.parse("EVENT_DATE_FORMAT", player)); DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern(Message.parse("EVENT_DATE_FORMAT", player));
Message.send("EVENT_COMING", player); Message.send("EVENT_COMING", player);
for(Event e : coming){ for(Event e : coming){
Message.send("EVENT_COMING_EVENT", player, e.getStart().toLocalDateTime().format(dateFormat), e.getEnd().toLocalDateTime().format(dateFormat), e.getEventName()); Message.send("EVENT_COMING_EVENT", player, e.getStart().toLocalDateTime().format(dateFormat), e.getEnd().toLocalDateTime().format(dateFormat), e.getEventName());
Set<Team> teams = TeamTeilnahme.getTeams(e.getEventID()); Set<Team> teams = TeamTeilnahme.getTeams(e.getEventID());
if(now.isBefore(e.getDeadline().toInstant())) {
Message.send("EVENT_COMING_DEADLINE", player, e.getDeadline());
}
if(!teams.isEmpty()){ if(!teams.isEmpty()){
StringBuilder tline = new StringBuilder(); StringBuilder tline = new StringBuilder();
for(Team t : teams){ for(Team t : teams){

Datei anzeigen

@ -509,7 +509,7 @@ public class TeamCommand extends BasicCommand {
return; return;
} }
if(Instant.now().isAfter(event.getEnd().toInstant())){ if(Instant.now().isAfter(event.getDeadline().toInstant())){
Message.send("TEAM_EVENT_OVER", player); Message.send("TEAM_EVENT_OVER", player);
return; return;
} }

Datei anzeigen

@ -37,6 +37,7 @@ public class Event {
private final int maximumTeamMembers; private final int maximumTeamMembers;
private final boolean publicSchemsOnly; private final boolean publicSchemsOnly;
private final boolean spectateSystem; private final boolean spectateSystem;
private final Timestamp deadline;
private static Event current = null; private static Event current = null;
@ -48,6 +49,7 @@ public class Event {
this.maximumTeamMembers = rs.getInt("MaximumTeamMembers"); this.maximumTeamMembers = rs.getInt("MaximumTeamMembers");
this.publicSchemsOnly = rs.getBoolean("PublicSchemsOnly"); this.publicSchemsOnly = rs.getBoolean("PublicSchemsOnly");
this.spectateSystem = rs.getBoolean("SpectateSystem"); this.spectateSystem = rs.getBoolean("SpectateSystem");
this.deadline = rs.getTimestamp("Deadline");
} }
public static Event get(){ public static Event get(){
@ -133,4 +135,7 @@ public class Event {
public boolean spectateSystem(){ public boolean spectateSystem(){
return spectateSystem; return spectateSystem;
} }
public Timestamp getDeadline() {
return deadline;
}
} }

Datei anzeigen

@ -177,6 +177,7 @@ EVENT_NO_FIGHT_TEAM=§cDas Team kämpft derzeit nicht
EVENT_NO_CURRENT=§cDerzeit findet kein Event statt EVENT_NO_CURRENT=§cDerzeit findet kein Event statt
EVENT_COMING=§eKommende Events§8: EVENT_COMING=§eKommende Events§8:
EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2} EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2}
EVENT_COMING_DEADLINE=§7 Anmeldeschluss§8: §7{0}
EVENT_COMING_TEAMS=§7 Mit§8:{0} EVENT_COMING_TEAMS=§7 Mit§8:{0}
EVENT_COMING_TEAM= §{0}{1} EVENT_COMING_TEAM= §{0}{1}
EVENT_CURRENT_EVENT=§e§l{0} EVENT_CURRENT_EVENT=§e§l{0}
@ -400,7 +401,7 @@ TEAM_EVENT_USAGE=§8/§7team event §8[§eEvent§8] - §7um daran teilzunehmen
TEAM_EVENT_HEADER=§7Dein Team nimmt an folgenden Events teil§8: TEAM_EVENT_HEADER=§7Dein Team nimmt an folgenden Events teil§8:
TEAM_EVENT_EVENT=§7{0}§8: §e{1} TEAM_EVENT_EVENT=§7{0}§8: §e{1}
TEAM_EVENT_NO_EVENT=§cDieses Event gibt es nicht TEAM_EVENT_NO_EVENT=§cDieses Event gibt es nicht
TEAM_EVENT_OVER=§cDieses Event ist bereits vorbei TEAM_EVENT_OVER=§cDie Anmeldephase für dieses Event ist bereits vorbei
TEAM_EVENT_LEFT=§7Dein Team nimmt nicht mehr am Event teil TEAM_EVENT_LEFT=§7Dein Team nimmt nicht mehr am Event teil
TEAM_EVENT_JOINED=§7Dein Team nimmt nun am Event §e{0} §7 teil! TEAM_EVENT_JOINED=§7Dein Team nimmt nun am Event §e{0} §7 teil!
TEAM_EVENT_HOW_TO_LEAVE=§7Um die Teilnahme abzusagen, wiederhole den Befehl TEAM_EVENT_HOW_TO_LEAVE=§7Um die Teilnahme abzusagen, wiederhole den Befehl