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..55d38a6a 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) @@ -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 @@ -70,11 +70,11 @@ class InternalKit(id: EntityID): CompositeEntity(id) { it[PersonalKitTable.kitName] = kitName } ) { - this.inventory = rawInventory - this.armor = rawArmor - this.inUse = true + this.rawInventory = rawInventory + this.rawArmor = rawArmor + this.inUse = false } - } + }.also { it.setDefault() } @JvmStatic fun getKitInUse(userId: Int, gamemode: String) = useDb { 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 diff --git a/CommonCore/SQL/src/de/steamwar/sql/internal/KotlinDatabase.kt b/CommonCore/SQL/src/de/steamwar/sql/internal/KotlinDatabase.kt index bf0cc9ff..97ecdead 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 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..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,7 @@ 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); + 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() {