Merge remote-tracking branch 'origin/master' into multitool/main
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

# Conflicts:
#	src/de/steamwar/sql/EventFight.java
#	src/de/steamwar/sql/Referee.java
Dieser Commit ist enthalten in:
Chaoscaot 2024-08-06 18:20:54 +02:00
Commit 076fa8ad78
5 geänderte Dateien mit 32 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -74,15 +74,15 @@ repositories {
} }
dependencies { dependencies {
compileOnly 'org.projectlombok:lombok:1.18.22' compileOnly 'org.projectlombok:lombok:1.18.32'
testCompileOnly 'org.projectlombok:lombok:1.18.22' testCompileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.22' annotationProcessor 'org.projectlombok:lombok:1.18.32'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22' testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
testImplementation 'org.hamcrest:hamcrest:2.2' testImplementation 'org.hamcrest:hamcrest:2.2'
compileOnly 'org.xerial:sqlite-jdbc:3.36.0' compileOnly 'org.xerial:sqlite-jdbc:3.46.0.0'
} }
task buildResources { task buildResources {

Datei anzeigen

@ -116,6 +116,20 @@ public class EventFight {
setFight.update(fight, fightID); setFight.update(fight, fightID);
} }
public boolean hasFinished() {
return fight != 0 || ergebnis != 0;
}
public void reschedule() {
startTime = Timestamp.from(new Date().toInstant().plus(30, SECONDS));
reschedule.update(startTime, fightID);
}
@Override
public int hashCode(){
return fightID;
}
public void update() { public void update() {
update.update(startTime, spielModus, map, teamBlue, teamRed, spectatePort, fightID); update.update(startTime, spielModus, map, teamBlue, teamRed, spectatePort, fightID);
} }

Datei anzeigen

@ -44,6 +44,8 @@ public class Referee {
delete.update(eventID, userID); delete.update(eventID, userID);
} }
private static final SelectStatement<Referee> byEvent = table.selectFields("eventID");
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());
} }

Datei anzeigen

@ -38,7 +38,7 @@ public class SWException {
private static final String SERVER_NAME = new File(CWD).getName(); private static final String SERVER_NAME = new File(CWD).getName();
private static final Table<SWException> table = new Table<>(SWException.class, "Exception"); private static final Table<SWException> table = new Table<>(SWException.class, "Exception");
private static final Statement insert = table.insertFields("server", "message", "stacktrace"); private static final Statement insert = table.insertFields(true, "server", "message", "stacktrace");
@Field(keys = {Table.PRIMARY}, autoincrement = true) @Field(keys = {Table.PRIMARY}, autoincrement = true)
private final int id; private final int id;
@ -52,10 +52,17 @@ public class SWException {
private final String stacktrace; private final String stacktrace;
public static void log(String message, String stacktrace){ public static void log(String message, String stacktrace){
insert.update(SERVER_NAME, generateMessage(message), stacktrace);
}
public static int logGetId(String message, String stacktrace) {
return insert.insertGetKey(SERVER_NAME, generateMessage(message), stacktrace);
}
private static String generateMessage(String message) {
StringBuilder msgBuilder = new StringBuilder(message); StringBuilder msgBuilder = new StringBuilder(message);
SQLWrapper.impl.additionalExceptionMetadata(msgBuilder); SQLWrapper.impl.additionalExceptionMetadata(msgBuilder);
msgBuilder.append("\nCWD: ").append(CWD); msgBuilder.append("\nCWD: ").append(CWD);
return msgBuilder.toString();
insert.update(SERVER_NAME, msgBuilder.toString(), stacktrace);
} }
} }

Datei anzeigen

@ -39,6 +39,7 @@ public enum UserPerm {
RESTRICTED_MODS, RESTRICTED_MODS,
COLOR_CHAT, COLOR_CHAT,
TEAM, TEAM,
TICKET_LOG,
BUILD, BUILD,
CHECK, CHECK,
MODERATION, MODERATION,