Dieser Commit ist enthalten in:
Ursprung
9da8320a41
Commit
6c9137bd18
@ -21,18 +21,13 @@ package de.steamwar.sql;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class Fight {
|
||||
private Fight(){}
|
||||
|
||||
public static int create(String gamemode, String server, Timestamp starttime, int duration, int blueleader, int redleader, Integer blueschem, Integer redschem, int win, String wincondition){
|
||||
return create(gamemode, server, starttime, duration, blueleader, redleader, blueschem, redschem, win, wincondition, Timestamp.from(Instant.now()));
|
||||
}
|
||||
|
||||
public static int create(String gamemode, String server, Timestamp starttime, int duration, int blueleader, int redleader, Integer blueschem, Integer redschem, int win, String wincondition, Timestamp replayLock){
|
||||
return Provider.impl.createFight(gamemode, server, starttime, duration, blueleader, redleader, blueschem, redschem, win, wincondition, replayLock);
|
||||
return Provider.impl.createFight(gamemode, server, starttime, duration, blueleader, redleader, blueschem, redschem, win, wincondition);
|
||||
}
|
||||
|
||||
public static void getReplay(int fightID, Consumer<InputStream> reader) {
|
||||
|
@ -48,7 +48,7 @@ public interface Provider {
|
||||
Set<Team> getEventTeams(int eventID);
|
||||
Set<Event> getTeamEvents(int teamID);
|
||||
|
||||
int createFight(String gamemode, String server, Timestamp starttime, int duration, int blueleader, int redleader, Integer blueschem, Integer redschem, int win, String wincondition, Timestamp replayLock);
|
||||
int createFight(String gamemode, String server, Timestamp starttime, int duration, int blueleader, int redleader, Integer blueschem, Integer redschem, int win, String wincondition);
|
||||
void getReplay(int fightID, Consumer<InputStream> reader);
|
||||
void setReplay(int fightID, InputStream data);
|
||||
|
||||
|
@ -137,11 +137,11 @@ public class SQLProvider implements Provider {
|
||||
}, teamID);
|
||||
}
|
||||
|
||||
private static final Statement createFight = new Statement("INSERT INTO Fight (GameMode, Server, StartTime, Duration, BlueLeader, RedLeader, BlueSchem, RedSchem, Win, WinCondition, ReplayLock) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
private static final Statement createFight = new Statement("INSERT INTO Fight (GameMode, Server, StartTime, Duration, BlueLeader, RedLeader, BlueSchem, RedSchem, Win, WinCondition) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
private static final Statement getLastFightID = new Statement("SELECT LAST_INSERT_ID() AS FightID");
|
||||
@Override
|
||||
public int createFight(String gamemode, String server, Timestamp starttime, int duration, int blueleader, int redleader, Integer blueschem, Integer redschem, int win, String wincondition, Timestamp replayLock) {
|
||||
createFight.update(gamemode, server, starttime, duration, blueleader, redleader, blueschem, redschem, win, wincondition, replayLock);
|
||||
public int createFight(String gamemode, String server, Timestamp starttime, int duration, int blueleader, int redleader, Integer blueschem, Integer redschem, int win, String wincondition) {
|
||||
createFight.update(gamemode, server, starttime, duration, blueleader, redleader, blueschem, redschem, win, wincondition);
|
||||
return getLastFightID.select(rs -> {
|
||||
rs.next();
|
||||
return rs.getInt("FightID");
|
||||
|
@ -96,7 +96,7 @@ public class StandaloneProvider implements Provider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int createFight(String gamemode, String server, Timestamp starttime, int duration, int blueleader, int redleader, Integer blueschem, Integer redschem, int win, String wincondition, Timestamp replayLock) {
|
||||
public int createFight(String gamemode, String server, Timestamp starttime, int duration, int blueleader, int redleader, Integer blueschem, Integer redschem, int win, String wincondition) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren