diff --git a/SpigotCore_Main/src/de/steamwar/sql/PersonalKit.java b/SpigotCore_Main/src/de/steamwar/sql/PersonalKit.java index d0b361f..263850c 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/PersonalKit.java +++ b/SpigotCore_Main/src/de/steamwar/sql/PersonalKit.java @@ -61,12 +61,13 @@ public class PersonalKit { } } - public static PersonalKit get(int userID, String gamemode, String name) { + public static List get(int userID, String gamemode, String name) { ResultSet rs = SQL.select("SELECT * FROM PersonalKit WHERE UserID = ? AND GameMode = ? AND Name = ?", userID, gamemode, name); try { - if(!rs.next()) - return null; - return new PersonalKit(rs); + List list = new ArrayList<>(); + while (rs.next()) + list.add(new PersonalKit(rs)); + return list; } catch (SQLException e) { throw new SecurityException("Failed loading personal kit", e); } @@ -93,7 +94,9 @@ public class PersonalKit { list.forEach(kit -> { if(list.indexOf(kit) >= 1) kit.setInUse(false); }); + list.removeIf(kit -> !kit.isInUse()); } + if(list.isEmpty()) return null; return list.get(0); } catch (SQLException e) { throw new SecurityException("Failed loading personal kit", e);