Adding statistics backend
Dieser Commit ist enthalten in:
Ursprung
7ca97476bd
Commit
21a2be5a43
24
SpigotCore_Main/src/de/steamwar/sql/Fight.java
Normale Datei
24
SpigotCore_Main/src/de/steamwar/sql/Fight.java
Normale Datei
@ -0,0 +1,24 @@
|
|||||||
|
package de.steamwar.sql;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
public class Fight {
|
||||||
|
private Fight(){}
|
||||||
|
|
||||||
|
public static int create(String gamemode, String arena, Timestamp starttime, int duration, int blueleader, int redleader, int blueschem, int redschem, int win, String wincondition){
|
||||||
|
SQL.update("INSERT INTO Fight (GameMode, Arena, StartTime, Duration, BlueLeader, RedLeader, BlueSchem, RedSchem, Win, WinCondition) VALUES (" +
|
||||||
|
"'" + SQL.disarmString(gamemode) + "', '" + SQL.disarmString(arena) + "', '" + starttime.toString() + "', " + duration + ", " + blueleader + ", " + redleader + ", " + blueschem + ", " + redschem + ", " + win + ", '" + SQL.disarmString(wincondition) + "'" +
|
||||||
|
")");
|
||||||
|
ResultSet rs = SQL.select("SELECT LAST_INSERT_ID() AS FightID");
|
||||||
|
try{
|
||||||
|
if(!rs.next())
|
||||||
|
throw new SecurityException("No last insert id");
|
||||||
|
|
||||||
|
return rs.getInt("FightID");
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new SecurityException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
SpigotCore_Main/src/de/steamwar/sql/FightPlayer.java
Normale Datei
11
SpigotCore_Main/src/de/steamwar/sql/FightPlayer.java
Normale Datei
@ -0,0 +1,11 @@
|
|||||||
|
package de.steamwar.sql;
|
||||||
|
|
||||||
|
public class FightPlayer {
|
||||||
|
private FightPlayer(){}
|
||||||
|
|
||||||
|
public static void create(int fightID, int userID, String kit, int kills, boolean isOut){
|
||||||
|
SQL.update("INSERT INTO FightPlayer (FightID, UserID, Kit, Kills, IsOut) VALUES (" +
|
||||||
|
fightID + ", " + userID + ", '" + SQL.disarmString(kit) + "', " + kills + ", " + SQL.booleanToInt(isOut) +
|
||||||
|
")");
|
||||||
|
}
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren