Long DiscordId #242
@ -56,7 +56,7 @@ public class AuthManager {
|
||||
if (TOKENS.containsKey(code)) {
|
||||
Member member = SteamwarDiscordBot.instance().getJda().getGuildById(SteamwarDiscordBotConfig.GUILD).retrieveMemberById(TOKENS.get(code).longValue()).complete();
|
||||
if(member == null) return null;
|
||||
user.setDiscordId(member.getId());
|
||||
user.setDiscordId(member.getIdLong());
|
||||
MessageBuilder builder = new MessageBuilder();
|
||||
builder.setContent(":white_check_mark: Dein Discord Konto wurde mit **" + user.getUserName() + "** verknüpft");
|
||||
builder.setActionRows(ActionRow.of(Button.success("tada", Emoji.fromUnicode("U+1F389")), Button.danger("invalid", "Ich war das nicht")));
|
||||
|
@ -63,7 +63,7 @@ public class SteamwarUser {
|
||||
private static final Map<String, SteamwarUser> usersByName = new HashMap<>();
|
||||
private static final Map<UUID, SteamwarUser> usersByUUID = new HashMap<>();
|
||||
private static final Map<Integer, SteamwarUser> usersById = new HashMap<>();
|
||||
private static final Map<String, SteamwarUser> usersByDiscord = new HashMap<>();
|
||||
private static final Map<Long, SteamwarUser> usersByDiscord = new HashMap<>();
|
||||
private static final InetAddress LIXFEL_DE;
|
||||
private static final String API_URL = "https://api.mojang.com/users/profiles/minecraft/";
|
||||
private static final JsonParser jsonParser = new JsonParser();
|
||||
@ -75,7 +75,7 @@ public class SteamwarUser {
|
||||
private int team;
|
||||
private boolean leader;
|
||||
private final Map<Punishment.PunishmentType, Punishment> punishments;
|
||||
private String discordId;
|
||||
private Long discordId;
|
||||
|
||||
static {
|
||||
try {
|
||||
@ -93,7 +93,7 @@ public class SteamwarUser {
|
||||
userGroup = UserGroup.getUsergroup(rs.getString("UserGroup"));
|
||||
team = rs.getInt("Team");
|
||||
leader = rs.getBoolean("Leader");
|
||||
discordId = rs.getString("DiscordId");
|
||||
discordId = rs.getLong("DiscordId");
|
||||
Chaoscaot markierte diese Unterhaltung als gelöst
|
||||
usersById.put(id, this);
|
||||
usersByName.put(userName.toLowerCase(), this);
|
||||
usersByUUID.put(uuid, this);
|
||||
@ -178,8 +178,8 @@ public class SteamwarUser {
|
||||
}
|
||||
|
||||
public static SteamwarUser get(Long discordId) {
|
||||
if(usersByDiscord.containsKey(discordId.toString()))
|
||||
return usersByDiscord.get(discordId.toString());
|
||||
if(usersByDiscord.containsKey(discordId))
|
||||
return usersByDiscord.get(discordId);
|
||||
return byDiscord.select(rs -> {
|
||||
if(rs.next())
|
||||
return new SteamwarUser(rs);
|
||||
@ -235,11 +235,11 @@ public class SteamwarUser {
|
||||
return punishments.getOrDefault(type, null);
|
||||
}
|
||||
|
||||
public String getDiscordId() {
|
||||
public Long getDiscordId() {
|
||||
return discordId;
|
||||
}
|
||||
|
||||
public void setDiscordId(String discordId) {
|
||||
public void setDiscordId(Long discordId) {
|
||||
usersByDiscord.remove(this.discordId);
|
||||
this.discordId = discordId;
|
||||
updateDiscord.update(discordId, id);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Inkorrekte "null" Behandlung. Gibt die Möglichkeit, erst mit z.B. getObject oder getString auf null zu prüfen, oder hinterher mit rs.wasNull()