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 de.steamwar.sql.internal.Table;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; 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> 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> byId = table.select(Table.PRIMARY);
private static final SelectStatement<Event> allShort = new SelectStatement<>(table, "SELECT * FROM Event"); 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 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", "spectateSystem"); 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); private static final Statement delete = table.delete(Table.PRIMARY);
@ -65,23 +66,30 @@ public class Event {
@Getter @Getter
@Field(keys = {Table.PRIMARY}, autoincrement = true) @Field(keys = {Table.PRIMARY}, autoincrement = true)
private final int eventID; private final int eventID;
@Setter
@Getter @Getter
@Field(keys = {"eventName"}) @Field(keys = {"eventName"})
private String eventName; private String eventName;
@Setter
@Getter @Getter
@Field @Field
private Timestamp deadline; private Timestamp deadline;
@Setter
@Getter @Getter
@Field @Field
private Timestamp start; private Timestamp start;
@Setter
@Getter @Getter
@Field @Field
private Timestamp end; private Timestamp end;
@Setter
@Getter @Getter
@Field @Field
private int maximumTeamMembers; private int maximumTeamMembers;
@Setter
@Field(nullable = true) @Field(nullable = true)
private SchematicType schemType; private SchematicType schemType;
@Setter
@Field @Field
private boolean publicSchemsOnly; private boolean publicSchemsOnly;
@Deprecated @Deprecated
@ -91,6 +99,8 @@ public class Event {
public boolean publicSchemsOnly() { public boolean publicSchemsOnly() {
return publicSchemsOnly; return publicSchemsOnly;
} }
@Deprecated
public boolean spectateSystem(){ public boolean spectateSystem(){
return spectateSystem; return spectateSystem;
} }
@ -99,39 +109,12 @@ public class Event {
return schemType; return schemType;
} }
public void setEventName(String eventName) { @Deprecated
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;
}
public void setSpectateSystem(boolean spectateSystem) { public void setSpectateSystem(boolean spectateSystem) {
this.spectateSystem = spectateSystem; this.spectateSystem = spectateSystem;
} }
public void setSchemType(SchematicType schemType) {
this.schemType = schemType;
}
public void update(){ 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 Statement setFight = table.update(Table.PRIMARY, "Fight");
private static final SelectStatement<EventFight> byEvent = table.selectFields("eventID"); 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 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 Statement delete = table.delete(Table.PRIMARY);
private static final Queue<EventFight> fights = new PriorityQueue<>(); private static final Queue<EventFight> fights = new PriorityQueue<>();
@ -96,8 +96,9 @@ public class EventFight {
@Deprecated @Deprecated
private int kampfleiter; private int kampfleiter;
@Getter @Getter
@Field @Setter
private int spectatePort; @Field(nullable = true)
private Integer spectatePort;
@Getter @Getter
@Field(def = "0") @Field(def = "0")
private int ergebnis; private int ergebnis;
@ -116,7 +117,7 @@ public class EventFight {
} }
public void update() { public void update() {
update.update(startTime, spielModus, map, teamBlue, teamRed, kampfleiter, fightID); update.update(startTime, spielModus, map, teamBlue, teamRed, spectatePort, fightID);
} }
public void delete() { public void delete() {

Datei anzeigen

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