12
0

Adding public-team

Dieser Commit ist enthalten in:
Lixfel 2019-11-16 08:40:04 +01:00
Ursprung ecb8eec074
Commit 3d42b4e091
2 geänderte Dateien mit 15 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -20,7 +20,7 @@ public enum SchematicType {
CWarShip1_8("CWS1.8", Type.CHECK_TYPE),
CWarGear1_7("CWG1.7", Type.CHECK_TYPE),
WarShip1_8("WS1.8", Type.CHECK_TYPE),
WarGear1_7("WG1.7", Type.FIGHT_TYPE, CWarGear1_7);
WarGear1_7("WG1.7", Type.CHECK_TYPE);
private static Map<String, SchematicType> fromDB = new HashMap<>();

Datei anzeigen

@ -11,26 +11,30 @@ public class Team {
private final String teamName;
private final int teamLeader;
private Team(ResultSet rs){
try {
teamId = rs.getInt("TeamID");
teamKuerzel = rs.getString("TeamKuerzel");
teamName = rs.getString("TeamName");
teamLeader = rs.getInt("TeamLeader");
} catch (SQLException e) {
throw new SecurityException("Could not load team", e);
}
private static final Team pub = new Team(0, "PUB", "Öffentlich", 0);
private Team(int teamId, String teamKuerzel, String teamName, int teamLeader){
this.teamId = teamId;
this.teamKuerzel = teamKuerzel;
this.teamName = teamName;
this.teamLeader = teamLeader;
}
private Team(ResultSet rs) throws SQLException {
this(rs.getInt("TeamID"), rs.getString("TeamKuerzel"), rs.getString("TeamName"), rs.getInt("TeamLeader"));
}
public static Team get(int id){
if(id == 0)
return pub;
ResultSet rs = SQL.select("SELECT * FROM Team WHERE TeamID = " + id);
try {
if(!rs.next())
return null;
return new Team(rs);
} catch (SQLException e) {
throw new SecurityException("Could not load team", e);
}
return new Team(rs);
}
public int getTeamId() {