List at get with name
Dieser Commit ist enthalten in:
Ursprung
e88f183e72
Commit
5266bb6492
@ -61,12 +61,13 @@ public class PersonalKit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PersonalKit get(int userID, String gamemode, String name) {
|
public static List<PersonalKit> get(int userID, String gamemode, String name) {
|
||||||
ResultSet rs = SQL.select("SELECT * FROM PersonalKit WHERE UserID = ? AND GameMode = ? AND Name = ?", userID, gamemode, name);
|
ResultSet rs = SQL.select("SELECT * FROM PersonalKit WHERE UserID = ? AND GameMode = ? AND Name = ?", userID, gamemode, name);
|
||||||
try {
|
try {
|
||||||
if(!rs.next())
|
List<PersonalKit> list = new ArrayList<>();
|
||||||
return null;
|
while (rs.next())
|
||||||
return new PersonalKit(rs);
|
list.add(new PersonalKit(rs));
|
||||||
|
return list;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new SecurityException("Failed loading personal kit", e);
|
throw new SecurityException("Failed loading personal kit", e);
|
||||||
}
|
}
|
||||||
@ -93,7 +94,9 @@ public class PersonalKit {
|
|||||||
list.forEach(kit -> {
|
list.forEach(kit -> {
|
||||||
if(list.indexOf(kit) >= 1) kit.setInUse(false);
|
if(list.indexOf(kit) >= 1) kit.setInUse(false);
|
||||||
});
|
});
|
||||||
|
list.removeIf(kit -> !kit.isInUse());
|
||||||
}
|
}
|
||||||
|
if(list.isEmpty()) return null;
|
||||||
return list.get(0);
|
return list.get(0);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new SecurityException("Failed loading personal kit", e);
|
throw new SecurityException("Failed loading personal kit", e);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren