forked from SteamWar/SteamWar
Format code
This commit is contained in:
@@ -53,7 +53,8 @@ data class TNTLeagueConfig(
|
||||
|
||||
init {
|
||||
if (eventFightId != null && eventFightId > 0) {
|
||||
eventFight = EventFight.byId(eventFightId) ?: throw IllegalArgumentException("EventFight with ID $eventFightId not found")
|
||||
eventFight = EventFight.byId(eventFightId)
|
||||
?: throw IllegalArgumentException("EventFight with ID $eventFightId not found")
|
||||
|
||||
event = Event.byId(eventFight.eventID)!!
|
||||
|
||||
@@ -80,14 +81,20 @@ data class TNTLeagueConfig(
|
||||
Price(
|
||||
config.getInt("$it.amount"),
|
||||
config.getInt("$it.price"),
|
||||
config.getString("$it.category")?.let { s -> categoryFromString[s] } ?: ItemCategory.REDSTONE,
|
||||
config.getString("$it.category")?.let { s -> categoryFromString[s] }
|
||||
?: ItemCategory.REDSTONE,
|
||||
config.getInt("$it.pinned", -1),
|
||||
config.getStringList("$it.extras").map { s -> extrasFromString[s]!! }.toSet()
|
||||
)
|
||||
}.mapKeys { Material.getMaterial(it.key) ?: Material.BARRIER }
|
||||
}.mapKeys {
|
||||
Material.getMaterial(it.key)
|
||||
?: Material.BARRIER
|
||||
}
|
||||
}
|
||||
|
||||
fun isEvent() = (config.eventFightId ?: 0) > 0
|
||||
fun isEvent() =
|
||||
(config.eventFightId
|
||||
?: 0) > 0
|
||||
}
|
||||
|
||||
data class Price(
|
||||
|
||||
@@ -76,7 +76,8 @@ object TNTLeagueWorldConfig {
|
||||
}
|
||||
|
||||
fun ConfigurationSection.getWorldLocation(s: String, default: Location? = null): Location {
|
||||
val section = getConfigurationSection(s) ?: return default!!
|
||||
val section = getConfigurationSection(s)
|
||||
?: return default!!
|
||||
|
||||
val x = section.getDouble("x")
|
||||
val y = section.getDouble("y")
|
||||
|
||||
@@ -53,15 +53,16 @@ data class TeamWorldConfig(
|
||||
return TeamWorldConfig(spawnLocation, dealerSpawn, itemSpawn, Area(targetPos1, targetPos2))
|
||||
}
|
||||
|
||||
private fun spawnDealer(loc: Location) = world.spawn(loc, WanderingTrader::class.java)
|
||||
.apply {
|
||||
customName(Component.text("Shop"))
|
||||
isCustomNameVisible = false
|
||||
isInvulnerable = true
|
||||
isSilent = true
|
||||
isCollidable = false
|
||||
isAware = false
|
||||
setAI(false)
|
||||
}
|
||||
private fun spawnDealer(loc: Location) =
|
||||
world.spawn(loc, WanderingTrader::class.java)
|
||||
.apply {
|
||||
customName(Component.text("Shop"))
|
||||
isCustomNameVisible = false
|
||||
isInvulnerable = true
|
||||
isSilent = true
|
||||
isCollidable = false
|
||||
isAware = false
|
||||
setAI(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user