Update CommonCore
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
Chaoscaot 2024-03-14 22:26:54 +01:00
Ursprung 187c2ea292
Commit 97e19990b5
3 geänderte Dateien mit 30 neuen und 35 gelöschten Zeilen

Datei anzeigen

@ -25,6 +25,7 @@ import de.steamwar.sql.internal.Statement;
import de.steamwar.sql.internal.Table;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.sql.Timestamp;
import java.util.List;
@ -41,8 +42,8 @@ public class Event {
private static final SelectStatement<Event> byCurrent = new SelectStatement<>(table, "SELECT * FROM Event WHERE Start < now() AND End > now()");
private static final SelectStatement<Event> byId = table.select(Table.PRIMARY);
private static final SelectStatement<Event> allShort = new SelectStatement<>(table, "SELECT * FROM Event");
private static final Statement create = table.insertFields(true, "eventName", "deadline", "start", "end", "maximumTeamMembers", "publicSchemsOnly", "spectateSystem");
private static final Statement update = table.update(Table.PRIMARY, "eventName", "deadline", "start", "end", "schemType", "maximumTeamMembers", "publicSchemsOnly", "spectateSystem");
private static final Statement create = table.insertFields(true, "eventName", "deadline", "start", "end", "maximumTeamMembers", "publicSchemsOnly");
private static final Statement update = table.update(Table.PRIMARY, "eventName", "deadline", "start", "end", "schemType", "maximumTeamMembers", "publicSchemsOnly");
private static final Statement delete = table.delete(Table.PRIMARY);
@ -65,23 +66,30 @@ public class Event {
@Getter
@Field(keys = {Table.PRIMARY}, autoincrement = true)
private final int eventID;
@Setter
@Getter
@Field(keys = {"eventName"})
private String eventName;
@Setter
@Getter
@Field
private Timestamp deadline;
@Setter
@Getter
@Field
private Timestamp start;
@Setter
@Getter
@Field
private Timestamp end;
@Setter
@Getter
@Field
private int maximumTeamMembers;
@Setter
@Field(nullable = true)
private SchematicType schemType;
@Setter
@Field
private boolean publicSchemsOnly;
@Deprecated
@ -91,6 +99,8 @@ public class Event {
public boolean publicSchemsOnly() {
return publicSchemsOnly;
}
@Deprecated
public boolean spectateSystem(){
return spectateSystem;
}
@ -99,39 +109,12 @@ public class Event {
return schemType;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
public void setDeadline(Timestamp deadline) {
this.deadline = deadline;
}
public void setStart(Timestamp start) {
this.start = start;
}
public void setEnd(Timestamp end) {
this.end = end;
}
public void setMaximumTeamMembers(int maximumTeamMembers) {
this.maximumTeamMembers = maximumTeamMembers;
}
public void setPublicSchemsOnly(boolean publicSchemsOnly) {
this.publicSchemsOnly = publicSchemsOnly;
}
@Deprecated
public void setSpectateSystem(boolean spectateSystem) {
this.spectateSystem = spectateSystem;
}
public void setSchemType(SchematicType schemType) {
this.schemType = schemType;
}
public void update(){
update.update(eventName, deadline, start, end, schemType, maximumTeamMembers, publicSchemsOnly, spectateSystem, eventID);
update.update(eventName, deadline, start, end, schemType, maximumTeamMembers, publicSchemsOnly, eventID);
}
}

Datei anzeigen

@ -47,7 +47,7 @@ public class EventFight {
private static final Statement setFight = table.update(Table.PRIMARY, "Fight");
private static final SelectStatement<EventFight> byEvent = table.selectFields("eventID");
private static final Statement update = table.update(Table.PRIMARY, "startTime", "spielModus", "map", "teamBlue", "teamRed", "kampfleiter");
private static final Statement create = table.insertFields(true, "eventID", "startTime", "spielModus", "map", "teamBlue", "teamRed", "kampfleiter");
private static final Statement create = table.insertFields(true, "eventID", "startTime", "spielModus", "map", "teamBlue", "teamRed", "spectatePort");
private static final Statement delete = table.delete(Table.PRIMARY);
private static final Queue<EventFight> fights = new PriorityQueue<>();
@ -96,8 +96,9 @@ public class EventFight {
@Deprecated
private int kampfleiter;
@Getter
@Field
private int spectatePort;
@Setter
@Field(nullable = true)
private Integer spectatePort;
@Getter
@Field(def = "0")
private int ergebnis;
@ -116,7 +117,7 @@ public class EventFight {
}
public void update() {
update.update(startTime, spielModus, map, teamBlue, teamRed, kampfleiter, fightID);
update.update(startTime, spielModus, map, teamBlue, teamRed, spectatePort, fightID);
}
public void delete() {

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.sql;
import de.steamwar.sql.internal.Field;
import de.steamwar.sql.internal.SelectStatement;
import de.steamwar.sql.internal.Statement;
import de.steamwar.sql.internal.Table;
import lombok.AllArgsConstructor;
@ -32,6 +33,16 @@ public class Referee {
private static final Table<Referee> table = new Table<>(Referee.class);
private static final SelectStatement<Referee> byEvent = table.select("eventID");
private static final Statement insert = table.insertAll();
private static final Statement delete = table.delete("eventReferee");
public static void add(int eventID, int userID) {
insert.update(eventID, userID);
}
public static void remove(int eventID, int userID) {
delete.update(eventID, userID);
}
public static Set<Integer> get(int eventID) {
return byEvent.listSelect(eventID).stream().map(referee -> referee.userID).collect(Collectors.toSet());