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