SteamWar/BungeeCore
Archiviert
13
2

Toggling TeamDeletion with TeamDeleted bit for database integrity

Dieser Commit ist enthalten in:
Lixfel 2019-12-22 08:35:10 +01:00
Ursprung e63e742c8e
Commit c24b1b362d

Datei anzeigen

@ -56,13 +56,13 @@ public class Team {
for(Team team : teamCache) for(Team team : teamCache)
if(team.teamKuerzel.equalsIgnoreCase(name)) if(team.teamKuerzel.equalsIgnoreCase(name))
return team; return team;
return load(select("SELECT * FROM Team WHERE lower(TeamName) = '" + SQL.disarmString(name).toLowerCase() + "' OR lower(TeamKuerzel) = '" + SQL.disarmString(name).toLowerCase() + "'")); return load(select("SELECT * FROM Team WHERE (lower(TeamName) = '" + SQL.disarmString(name).toLowerCase() + "' OR lower(TeamKuerzel) = '" + SQL.disarmString(name).toLowerCase() + "') AND NOT TeamDeleted"));
} }
public static List<Team> getAll(){ public static List<Team> getAll(){
clearCache(); clearCache();
try{ try{
ResultSet rs = select("SELECT * FROM Team WHERE TeamID > 0"); ResultSet rs = select("SELECT * FROM Team WHERE NOT TeamDeleted");
if(rs == null) if(rs == null)
return teamCache; return teamCache;
@ -141,7 +141,7 @@ public class Team {
} }
public void disband(){ public void disband(){
SQL.update("DELETE FROM Team WHERE TeamID = " + teamId); SQL.update("UPDATE Team SET TeamDeleted = 1, TeamLeader = NULL WHERE TeamID = " + teamId);
teamCache.remove(this); teamCache.remove(this);
} }