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 = 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 = emptyMap() )