From 3e064f7e4c25bd5d9550da436e28eded598f9408 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 10 Apr 2023 12:58:17 +0200 Subject: [PATCH] Merge CommonCore Master --- src/de/steamwar/sql/EventFight.java | 2 +- src/de/steamwar/sql/SteamwarUser.java | 33 ++++----------------------- src/de/steamwar/sql/Team.java | 4 ++-- 3 files changed, 7 insertions(+), 32 deletions(-) diff --git a/src/de/steamwar/sql/EventFight.java b/src/de/steamwar/sql/EventFight.java index 76c6684..c7b80db 100644 --- a/src/de/steamwar/sql/EventFight.java +++ b/src/de/steamwar/sql/EventFight.java @@ -36,7 +36,7 @@ import java.util.*; import static java.time.temporal.ChronoUnit.SECONDS; @AllArgsConstructor -public class EventFight implements Comparable { +public class EventFight { private static final Table table = new Table<>(EventFight.class); private static final SelectStatement byId = table.select(Table.PRIMARY); diff --git a/src/de/steamwar/sql/SteamwarUser.java b/src/de/steamwar/sql/SteamwarUser.java index 5263b2f..4ca191f 100644 --- a/src/de/steamwar/sql/SteamwarUser.java +++ b/src/de/steamwar/sql/SteamwarUser.java @@ -106,6 +106,10 @@ public class SteamwarUser { return loadPunishments(byDiscord.select(discordId)); } + public static List getAll() { + return getAll.listSelect(); + } + public static SteamwarUser getOrCreate(UUID uuid, String name, Consumer newPlayer, BiConsumer nameUpdate) { SteamwarUser user = get(uuid); @@ -278,33 +282,4 @@ public class SteamwarUser { usersByDiscord.put(discordId, this); } } - - public static SteamwarUser get(int id) { - SteamwarUser user = usersById.get(id); - if(user != null) - return user; - return byID.select(id); - } - - public static SteamwarUser get(Long discordId) { - if(usersByDiscord.containsKey(discordId)) - return usersByDiscord.get(discordId); - return byDiscord.select(discordId); - } - - public static List getAll() { - return getAll.listSelect(); - } - - public static void createOrUpdateUsername(UUID uuid, String userName) { - insert.update(uuid, userName); - } - - public static List getServerTeam() { - return getServerTeam.listSelect(); - } - - public static List getTeam(int teamId) { - return byTeam.listSelect(teamId); - } } diff --git a/src/de/steamwar/sql/Team.java b/src/de/steamwar/sql/Team.java index 7afeafa..66beede 100644 --- a/src/de/steamwar/sql/Team.java +++ b/src/de/steamwar/sql/Team.java @@ -76,9 +76,9 @@ public class Team { public static Team get(int id) { if(id == -1) - return new Team(-1, "?", "?", "8"); + return new Team(-1, "?", "?", "8", "", 25565, false); if(id == 0) - return pub; + return new Team(0, "PUB", "Public", "8", "", 25565, false); return byId.select(id); }