forked from SteamWar/SteamWar
Merge branch 'main' into RemoveElo
This commit is contained in:
+2
-1
@@ -20,4 +20,5 @@ lib
|
|||||||
/WebsiteBackend/data
|
/WebsiteBackend/data
|
||||||
/WebsiteBackend/logs
|
/WebsiteBackend/logs
|
||||||
/WebsiteBackend/skins
|
/WebsiteBackend/skins
|
||||||
/WebsiteBackend/config.json
|
/WebsiteBackend/config.json
|
||||||
|
/WebsiteBackend/sessions
|
||||||
@@ -33,8 +33,8 @@ object PersonalKitTable: CompositeIdTable("PersonalKit") {
|
|||||||
val userId = reference("UserId", SteamwarUserTable)
|
val userId = reference("UserId", SteamwarUserTable)
|
||||||
val gamemode = varchar("Gamemode", 64).entityId()
|
val gamemode = varchar("Gamemode", 64).entityId()
|
||||||
val kitName = varchar("Name", 64).entityId()
|
val kitName = varchar("Name", 64).entityId()
|
||||||
val inventory = text("Inventory")
|
val inventory = text("Inventory", eagerLoading = true)
|
||||||
val armor = text("Armor")
|
val armor = text("Armor", eagerLoading = true)
|
||||||
val inUse = bool("InUse")
|
val inUse = bool("InUse")
|
||||||
|
|
||||||
override val primaryKey = PrimaryKey(userId, gamemode, kitName)
|
override val primaryKey = PrimaryKey(userId, gamemode, kitName)
|
||||||
@@ -54,7 +54,7 @@ class InternalKit(id: EntityID<CompositeID>): CompositeEntity(id) {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun get(userId: Int, gamemode: String, kitName: String) = useDb {
|
fun get(userId: Int, gamemode: String, kitName: String) = useDb {
|
||||||
get(CompositeID {
|
findById(CompositeID {
|
||||||
it[PersonalKitTable.userId] = EntityID(userId, SteamwarUserTable)
|
it[PersonalKitTable.userId] = EntityID(userId, SteamwarUserTable)
|
||||||
it[PersonalKitTable.gamemode] = gamemode
|
it[PersonalKitTable.gamemode] = gamemode
|
||||||
it[PersonalKitTable.kitName] = kitName
|
it[PersonalKitTable.kitName] = kitName
|
||||||
@@ -70,11 +70,11 @@ class InternalKit(id: EntityID<CompositeID>): CompositeEntity(id) {
|
|||||||
it[PersonalKitTable.kitName] = kitName
|
it[PersonalKitTable.kitName] = kitName
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
this.inventory = rawInventory
|
this.rawInventory = rawInventory
|
||||||
this.armor = rawArmor
|
this.rawArmor = rawArmor
|
||||||
this.inUse = true
|
this.inUse = false
|
||||||
}
|
}
|
||||||
}
|
}.also { it.setDefault() }
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getKitInUse(userId: Int, gamemode: String) = useDb {
|
fun getKitInUse(userId: Int, gamemode: String) = useDb {
|
||||||
|
|||||||
@@ -169,8 +169,8 @@ class SteamwarUser(id: EntityID<Int>): IntEntity(id) {
|
|||||||
}
|
}
|
||||||
fun isLeader() = leader
|
fun isLeader() = leader
|
||||||
|
|
||||||
var locale: Locale by SteamwarUserTable.locale
|
var locale: Locale? by SteamwarUserTable.locale
|
||||||
.transform({ it.toLanguageTag() }, { it?.let { Locale.forLanguageTag(it) } ?: Locale.getDefault()})
|
.transform({ it?.toLanguageTag() }, { it?.let { Locale.forLanguageTag(it) } })
|
||||||
var manualLocale by SteamwarUserTable.manualLocale
|
var manualLocale by SteamwarUserTable.manualLocale
|
||||||
var bedrock by SteamwarUserTable.bedrock
|
var bedrock by SteamwarUserTable.bedrock
|
||||||
private var passwordInternal by SteamwarUserTable.password
|
private var passwordInternal by SteamwarUserTable.password
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import org.intellij.lang.annotations.Language
|
|||||||
import org.jetbrains.exposed.v1.core.ColumnType
|
import org.jetbrains.exposed.v1.core.ColumnType
|
||||||
import org.jetbrains.exposed.v1.core.Expression
|
import org.jetbrains.exposed.v1.core.Expression
|
||||||
import org.jetbrains.exposed.v1.core.ResultRow
|
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.core.statements.StatementType
|
||||||
import org.jetbrains.exposed.v1.dao.IntEntity
|
import org.jetbrains.exposed.v1.dao.IntEntity
|
||||||
import org.jetbrains.exposed.v1.dao.IntEntityClass
|
import org.jetbrains.exposed.v1.dao.IntEntityClass
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public class GUI {
|
|||||||
}
|
}
|
||||||
Kit prototype = Kit.getAvailableKits(Fight.getFightPlayer(p).isLeader()).get(0);
|
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());
|
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();
|
anvilInv.open();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class PersonalKit {
|
|||||||
|
|
||||||
public ItemStack[] getArmor(){
|
public ItemStack[] getArmor(){
|
||||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(new StringReader(getRawArmor()));
|
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() {
|
public void setInUse() {
|
||||||
|
|||||||
Reference in New Issue
Block a user