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);
|
||||
try {
|
||||
if(!rs.next())
|
||||
return null;
|
||||
return new PersonalKit(rs);
|
||||
List<PersonalKit> 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);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren