From 975b2bb8e65bd633c2f3ec4e8b1d1a9cb5f07a5e Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 20 Dec 2025 21:35:34 +0100 Subject: [PATCH 1/6] Fix Kits and Maybe? Locale Signed-off-by: Chaoscaot --- .gitignore | 3 ++- CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt | 2 +- CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index cc1b960d..803a132b 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,5 @@ lib /WebsiteBackend/data /WebsiteBackend/logs /WebsiteBackend/skins -/WebsiteBackend/config.json \ No newline at end of file +/WebsiteBackend/config.json +/WebsiteBackend/sessions \ No newline at end of file diff --git a/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt b/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt index 5daa1128..c8b6d897 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt @@ -54,7 +54,7 @@ class InternalKit(id: EntityID): CompositeEntity(id) { @JvmStatic fun get(userId: Int, gamemode: String, kitName: String) = useDb { - get(CompositeID { + findById(CompositeID { it[PersonalKitTable.userId] = EntityID(userId, SteamwarUserTable) it[PersonalKitTable.gamemode] = gamemode it[PersonalKitTable.kitName] = kitName diff --git a/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt b/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt index 3f07d42d..8f747046 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/SteamwarUser.kt @@ -169,8 +169,8 @@ class SteamwarUser(id: EntityID): IntEntity(id) { } fun isLeader() = leader - var locale: Locale by SteamwarUserTable.locale - .transform({ it.toLanguageTag() }, { it?.let { Locale.forLanguageTag(it) } ?: Locale.getDefault()}) + var locale: Locale? by SteamwarUserTable.locale + .transform({ it?.toLanguageTag() }, { it?.let { Locale.forLanguageTag(it) } }) var manualLocale by SteamwarUserTable.manualLocale var bedrock by SteamwarUserTable.bedrock private var passwordInternal by SteamwarUserTable.password From feac17d7326e933321b33cd3ee632bba6cc659a6 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 20 Dec 2025 21:58:44 +0100 Subject: [PATCH 2/6] Fix kits frfr Signed-off-by: Chaoscaot --- .../src/de/steamwar/fightsystem/commands/GUI.java | 3 ++- .../SpigotCore_Main/src/de/steamwar/sql/PersonalKit.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java index 729ce0b6..bd66ffeb 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java @@ -182,7 +182,8 @@ public class GUI { } Kit prototype = Kit.getAvailableKits(Fight.getFightPlayer(p).isLeader()).get(0); PersonalKit kit = PersonalKit.create(user.getId(), Config.GameModeConfig.Schematic.Type.toDB(), s, prototype.getInventory(), prototype.getArmor()); - PersonalKitCreator.openKitCreator(p, kit); + p.closeInventory(); + Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> PersonalKitCreator.openKitCreator(p, kit)); }); anvilInv.open(); }); diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/sql/PersonalKit.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/sql/PersonalKit.java index e8ac661e..f074db30 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/sql/PersonalKit.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/sql/PersonalKit.java @@ -55,7 +55,7 @@ public class PersonalKit { public ItemStack[] getArmor(){ YamlConfiguration config = YamlConfiguration.loadConfiguration(new StringReader(getRawArmor())); - return Objects.requireNonNull(config.getList("Armor")).toArray(new ItemStack[0]); + return Objects.requireNonNull(config.getList("Armor")).toArray(new ItemStack[4]); } public void setInUse() { From 1269e4d97118916d474ae279d52bb6bbfb5baefd Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 20 Dec 2025 22:03:09 +0100 Subject: [PATCH 3/6] Fix kits frfrfr Signed-off-by: Chaoscaot --- CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt | 4 ++-- .../src/de/steamwar/fightsystem/commands/GUI.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt b/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt index c8b6d897..f1bd3c79 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt @@ -33,8 +33,8 @@ object PersonalKitTable: CompositeIdTable("PersonalKit") { val userId = reference("UserId", SteamwarUserTable) val gamemode = varchar("Gamemode", 64).entityId() val kitName = varchar("Name", 64).entityId() - val inventory = text("Inventory") - val armor = text("Armor") + val inventory = text("Inventory", eagerLoading = true) + val armor = text("Armor", eagerLoading = true) val inUse = bool("InUse") override val primaryKey = PrimaryKey(userId, gamemode, kitName) diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java index bd66ffeb..99236c84 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java @@ -182,7 +182,6 @@ public class GUI { } Kit prototype = Kit.getAvailableKits(Fight.getFightPlayer(p).isLeader()).get(0); PersonalKit kit = PersonalKit.create(user.getId(), Config.GameModeConfig.Schematic.Type.toDB(), s, prototype.getInventory(), prototype.getArmor()); - p.closeInventory(); Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> PersonalKitCreator.openKitCreator(p, kit)); }); anvilInv.open(); From d348e4a48078b4eae2fc44ebf7101df2377ed5ab Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 20 Dec 2025 22:10:25 +0100 Subject: [PATCH 4/6] Fix kits frfrfrfr? Signed-off-by: Chaoscaot --- CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt | 3 +-- CommonCore/SQL/src/de/steamwar/sql/internal/KotlinDatabase.kt | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt b/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt index f1bd3c79..a5df337e 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt @@ -72,9 +72,8 @@ class InternalKit(id: EntityID): CompositeEntity(id) { ) { this.inventory = rawInventory this.armor = rawArmor - this.inUse = true } - } + }.also { it.setDefault() } @JvmStatic fun getKitInUse(userId: Int, gamemode: String) = useDb { diff --git a/CommonCore/SQL/src/de/steamwar/sql/internal/KotlinDatabase.kt b/CommonCore/SQL/src/de/steamwar/sql/internal/KotlinDatabase.kt index bf0cc9ff..11504eea 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/internal/KotlinDatabase.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/internal/KotlinDatabase.kt @@ -23,6 +23,7 @@ import org.intellij.lang.annotations.Language import org.jetbrains.exposed.v1.core.ColumnType import org.jetbrains.exposed.v1.core.Expression import org.jetbrains.exposed.v1.core.ResultRow +import org.jetbrains.exposed.v1.core.StdOutSqlLogger import org.jetbrains.exposed.v1.core.statements.StatementType import org.jetbrains.exposed.v1.dao.IntEntity import org.jetbrains.exposed.v1.dao.IntEntityClass @@ -69,6 +70,7 @@ object KotlinDatabase { fun useDb(statement: JdbcTransaction.() -> T): T { KotlinDatabase.ensureConnected() return TransactionManager.currentOrNull()?.statement() ?: transaction(KotlinDatabase.db) { + addLogger(StdOutSqlLogger) statement() } } From 6a619c2fd1c5d45248747d9225dc0dbbc380705e Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 20 Dec 2025 22:12:48 +0100 Subject: [PATCH 5/6] Fix kits frfrfrfrfr? Signed-off-by: Chaoscaot --- CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt b/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt index a5df337e..1205ebfb 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt @@ -72,6 +72,7 @@ class InternalKit(id: EntityID): CompositeEntity(id) { ) { this.inventory = rawInventory this.armor = rawArmor + this.inUse = false } }.also { it.setDefault() } From 8358203cd45d021eaaf250f6adad0b668e5e754f Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 20 Dec 2025 22:15:30 +0100 Subject: [PATCH 6/6] Fix kits frfrfrfrfrfr Signed-off-by: Chaoscaot --- CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt | 4 ++-- CommonCore/SQL/src/de/steamwar/sql/internal/KotlinDatabase.kt | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt b/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt index 1205ebfb..55d38a6a 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/PersonalKit.kt @@ -70,8 +70,8 @@ class InternalKit(id: EntityID): CompositeEntity(id) { it[PersonalKitTable.kitName] = kitName } ) { - this.inventory = rawInventory - this.armor = rawArmor + this.rawInventory = rawInventory + this.rawArmor = rawArmor this.inUse = false } }.also { it.setDefault() } diff --git a/CommonCore/SQL/src/de/steamwar/sql/internal/KotlinDatabase.kt b/CommonCore/SQL/src/de/steamwar/sql/internal/KotlinDatabase.kt index 11504eea..97ecdead 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/internal/KotlinDatabase.kt +++ b/CommonCore/SQL/src/de/steamwar/sql/internal/KotlinDatabase.kt @@ -70,7 +70,6 @@ object KotlinDatabase { fun useDb(statement: JdbcTransaction.() -> T): T { KotlinDatabase.ensureConnected() return TransactionManager.currentOrNull()?.statement() ?: transaction(KotlinDatabase.db) { - addLogger(StdOutSqlLogger) statement() } }