Merge branch 'statistics' of SteamWar/SpigotCore into master
Dieser Commit ist enthalten in:
Commit
f08decf551
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