1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
package cat.freya.khs.config
import cat.freya.khs.world.Position
data class LegacyPosition(
var x: Double = 0.0,
var y: Double = 0.0,
var z: Double = 0.0,
@Omittable @KhsDeprecated("2.0.0") var world: String? = null,
) {
fun toPosition(): Position = Position(x, y, z)
}
data class SpawnsConfig(
// 1.x series of KHS stored game world in the positions
// so we need to load it in to be able to migrate
// it
var game: LegacyPosition? = null,
var lobby: Position? = null,
var seeker: Position? = null,
)
data class BoundConfig(var x: Double = 0.0, var z: Double = 0.0)
data class BoundsConfig(var min: BoundConfig? = null, var max: BoundConfig? = null)
data class WorldBorderConfig(
var enabled: Boolean = false,
var pos: Position? = null,
var size: ULong? = null,
var delay: ULong? = null,
var move: ULong? = null,
)
data class BlockHuntConfig(var enabled: Boolean = false, var blocks: List<String> = emptyList())
data class MapConfig(
var world: String? = null,
var spawns: SpawnsConfig = SpawnsConfig(),
var bounds: BoundsConfig = BoundsConfig(),
var worldBorder: WorldBorderConfig = WorldBorderConfig(),
var blockHunt: BlockHuntConfig = BlockHuntConfig(),
) {
fun migrate() {
// migrate from v1 world
if (world != null) return
// move world name
world = spawns.game?.world
spawns.game?.world = null
}
}
data class KhsMapsConfig(
@Comment("DO NOT EDIT THIS FILE - It is autogenerated")
@Comment("Please use /hs map ... commands instead")
var maps: Map<String, MapConfig> = emptyMap()
)
|