From c24b1b362d5b8f009634fa7f975c7fbee5d262d5 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 22 Dec 2019 08:35:10 +0100 Subject: [PATCH] Toggling TeamDeletion with TeamDeleted bit for database integrity --- src/de/steamwar/bungeecore/sql/Team.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/sql/Team.java b/src/de/steamwar/bungeecore/sql/Team.java index 112997a..959bfb2 100644 --- a/src/de/steamwar/bungeecore/sql/Team.java +++ b/src/de/steamwar/bungeecore/sql/Team.java @@ -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 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); } -- 2.39.5