SteamWar/BungeeCore
Archiviert
13
2

Toggling TeamDeletion with TeamDeleted bit for database integrity #43

Zusammengeführt
Lixfel hat 1 Commits von reworkTeamDeletion nach master 2019-12-22 17:24:26 +01:00 zusammengeführt

Datei anzeigen

@ -56,13 +56,13 @@ public class Team {
for(Team team : teamCache)
if(team.teamKuerzel.equalsIgnoreCase(name))
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(){
clearCache();
try{
ResultSet rs = select("SELECT * FROM Team WHERE TeamID > 0");
ResultSet rs = select("SELECT * FROM Team WHERE NOT TeamDeleted");
if(rs == null)
return teamCache;
@ -141,7 +141,7 @@ public class Team {
}
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);
}