Dieser Commit ist enthalten in:
Ursprung
95b46f3a9a
Commit
3778d6c1f9
@ -81,27 +81,27 @@ public class SteamwarUser {
|
||||
SteamwarUser user = usersByName.get(userName.toLowerCase());
|
||||
if(user != null)
|
||||
return user;
|
||||
return byName.select(userName);
|
||||
return loadPunishments(byName.select(userName));
|
||||
}
|
||||
|
||||
public static SteamwarUser get(UUID uuid){
|
||||
SteamwarUser user = usersByUUID.get(uuid);
|
||||
if(user != null)
|
||||
return user;
|
||||
return byUUID.select(uuid);
|
||||
return loadPunishments(byUUID.select(uuid));
|
||||
}
|
||||
|
||||
public static SteamwarUser get(int id) {
|
||||
SteamwarUser user = usersById.get(id);
|
||||
if(user != null)
|
||||
return user;
|
||||
return byID.select(id);
|
||||
return loadPunishments(byID.select(id));
|
||||
}
|
||||
|
||||
public static SteamwarUser get(Long discordId) {
|
||||
if(usersByDiscord.containsKey(discordId))
|
||||
return usersByDiscord.get(discordId);
|
||||
return byDiscord.select(discordId);
|
||||
return loadPunishments(byDiscord.select(discordId));
|
||||
}
|
||||
|
||||
public static SteamwarUser getOrCreate(UUID uuid, String name, Consumer<UUID> newPlayer, BiConsumer<String, String> nameUpdate) {
|
||||
@ -123,11 +123,11 @@ public class SteamwarUser {
|
||||
}
|
||||
|
||||
public static List<SteamwarUser> getServerTeam() {
|
||||
return getServerTeam.listSelect();
|
||||
return loadPunishments(getServerTeam.listSelect());
|
||||
}
|
||||
|
||||
public static List<SteamwarUser> getTeam(int teamId) {
|
||||
return byTeam.listSelect(teamId);
|
||||
return loadPunishments(byTeam.listSelect(teamId));
|
||||
}
|
||||
|
||||
public static void batchCache(Set<Integer> ids) {
|
||||
@ -140,6 +140,16 @@ public class SteamwarUser {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<SteamwarUser> loadPunishments(List<SteamwarUser> users) {
|
||||
users.forEach(user -> user.punishments = Punishment.getPunishmentsOfPlayer(user.getId()));
|
||||
return users;
|
||||
}
|
||||
|
||||
private static SteamwarUser loadPunishments(SteamwarUser user) {
|
||||
user.punishments = Punishment.getPunishmentsOfPlayer(user.getId());
|
||||
return user;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Field(keys = {Table.PRIMARY}, autoincrement = true)
|
||||
private final int id;
|
||||
@ -165,7 +175,7 @@ public class SteamwarUser {
|
||||
@Field(keys = {"discordId"}, nullable = true)
|
||||
private Long discordId;
|
||||
|
||||
private final Map<Punishment.PunishmentType, Punishment> punishments;
|
||||
private Map<Punishment.PunishmentType, Punishment> punishments;
|
||||
|
||||
public SteamwarUser(int id, UUID uuid, String userName, UserGroup userGroup, int team, boolean leader, Locale locale, boolean manualLocale, Long discordId) {
|
||||
this.id = id;
|
||||
@ -184,7 +194,6 @@ public class SteamwarUser {
|
||||
if (this.discordId != null) {
|
||||
usersByDiscord.put(discordId, this);
|
||||
}
|
||||
punishments = Punishment.getPunishmentsOfPlayer(id); //TODO load always on Subservers?
|
||||
}
|
||||
|
||||
public UUID getUUID() {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren