diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 207513a..c0dae04 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,10 +12,10 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: temurin java-version: 17 diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-packages.yml similarity index 64% rename from .github/workflows/publish-snapshot.yml rename to .github/workflows/publish-packages.yml index c28f98a..837779e 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-packages.yml @@ -1,4 +1,4 @@ -name: Publish Snapshot +name: Publish GitHub Packages on: push: @@ -12,17 +12,20 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: temurin java-version: 17 - cache: gradle - - name: Grant execute permission for gradlew - run: chmod +x gradlew + - name: Set env variable from latest maven version + run: > + echo "RELEASE_VERSION=$( \ + curl https://repo.mineinabyss.com/releases/com/mineinabyss/deeperworld/maven-metadata.xml | \ + grep -oP '(?!)[\d\.]*(?=)' \ + )" >> $GITHUB_ENV - name: Run gradle build and publish run: gradle build publish -PmineinabyssMavenUsername=${{ secrets.MAVEN_PUBLISH_USERNAME }} -PmineinabyssMavenPassword=${{ secrets.MAVEN_PUBLISH_PASSWORD }} @@ -31,7 +34,7 @@ jobs: shell: bash id: extract_version run: | - version=`./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}'` + version=`gradle properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}'` echo "::set-output name=version::$version" - name: Create GitHub Release diff --git a/build.gradle.kts b/build.gradle.kts index 0523177..525f77a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -35,5 +35,5 @@ dependencies { compileOnly(deeperLibs.minecraft.plugin.blocklocker) // Shaded - implementation(libs.idofront.core) + implementation(libs.bundles.idofront.core) } diff --git a/gradle.properties b/gradle.properties index 2680161..0e7a099 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=com.mineinabyss -version=0.6 -kotlinVersion=1.6.10 +version=0.7 +kotlinVersion=1.7.10 serverVersion=1.19.2-R0.1-SNAPSHOT -idofrontVersion=0.12.112 +idofrontVersion=0.14.6 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 00e33ed..ae04661 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/DeeperCommandExecutor.kt b/src/main/kotlin/com/mineinabyss/deeperworld/DeeperCommandExecutor.kt index f3ad24f..6f3e106 100644 --- a/src/main/kotlin/com/mineinabyss/deeperworld/DeeperCommandExecutor.kt +++ b/src/main/kotlin/com/mineinabyss/deeperworld/DeeperCommandExecutor.kt @@ -2,7 +2,6 @@ package com.mineinabyss.deeperworld import com.fastasyncworldedit.core.util.TaskManager import com.mineinabyss.deeperworld.MinecraftConstants.FULL_DAY_TIME -import com.mineinabyss.deeperworld.config.DeeperConfig import com.mineinabyss.deeperworld.services.WorldManager import com.mineinabyss.deeperworld.services.canMoveSections import com.mineinabyss.deeperworld.synchronization.sync @@ -16,6 +15,7 @@ import com.mineinabyss.idofront.commands.arguments.intArg import com.mineinabyss.idofront.commands.execution.IdofrontCommandExecutor import com.mineinabyss.idofront.commands.execution.stopCommand import com.mineinabyss.idofront.commands.extensions.actions.playerAction +import com.mineinabyss.idofront.config.config import com.mineinabyss.idofront.messaging.error import com.mineinabyss.idofront.messaging.info import com.mineinabyss.idofront.messaging.success @@ -37,6 +37,11 @@ import org.bukkit.command.TabCompleter class DeeperCommandExecutor : IdofrontCommandExecutor(), TabCompleter { override val commands: CommandHolder = commands(deeperWorld) { ("deeperworld" / "dw") { + "reload" { + action { + deeperWorld.config = config("config.yml") { deeperWorld.fromPluginPath(loadDefault = true)} + } + } "tp"(desc = "Enables or disables automatic teleports between sections for a player") { val state by booleanArg() playerAction { @@ -62,11 +67,11 @@ class DeeperCommandExecutor : IdofrontCommandExecutor(), TabCompleter { val time by intArg() "set"(desc = "Set the time of the main synchronization world and the other worlds with their respective offsets") { playerAction { - DeeperConfig.data.time.mainWorld?.let { world -> + deeperConfig.time.mainWorld?.let { world -> world.time = time.toLong() } ?: command.stopCommand("No main world specified for time synchronization. Check the config!") - DeeperConfig.data.time.syncedWorlds.forEach { (world, offset) -> + deeperConfig.time.syncedWorlds.forEach { (world, offset) -> world.time = (time.toLong() + offset) % FULL_DAY_TIME } @@ -75,10 +80,10 @@ class DeeperCommandExecutor : IdofrontCommandExecutor(), TabCompleter { } "add"(desc = "Add to the main synchronization world time and the other worlds with their respective offsets") { playerAction { - DeeperConfig.data.time.mainWorld?.let { mainWorld -> + deeperConfig.time.mainWorld?.let { mainWorld -> mainWorld.time += time.toLong() - DeeperConfig.data.time.syncedWorlds.forEach { (world, offset) -> + deeperConfig.time.syncedWorlds.forEach { (world, offset) -> world.time = (mainWorld.time + offset) % FULL_DAY_TIME } @@ -197,6 +202,7 @@ class DeeperCommandExecutor : IdofrontCommandExecutor(), TabCompleter { ): List { return when (args.size) { 1 -> listOf( + "reload", "linfo", "tp", "time", diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/DeeperConfig.kt b/src/main/kotlin/com/mineinabyss/deeperworld/DeeperConfig.kt new file mode 100644 index 0000000..bae4222 --- /dev/null +++ b/src/main/kotlin/com/mineinabyss/deeperworld/DeeperConfig.kt @@ -0,0 +1,45 @@ +@file:UseSerializers(DurationSerializer::class) + +package com.mineinabyss.deeperworld + +import com.mineinabyss.deeperworld.world.section.Section +import com.mineinabyss.idofront.serialization.DurationSerializer +import com.mineinabyss.idofront.serialization.WorldSerializer +import com.mineinabyss.idofront.time.ticks +import kotlinx.serialization.Serializable +import kotlinx.serialization.UseSerializers +import org.bukkit.World +import kotlin.time.Duration +import kotlin.time.Duration.Companion.seconds + +val deeperConfig get() = deeperWorld.config.data.deeperConfig +@Serializable +data class DeeperWorldConfig(val deeperConfig: DeeperConfig = DeeperConfig()) { + @Serializable + data class DeeperConfig( + val sections: List
= emptyList(), + val damageOutsideSections: Double = 0.0, + val damageExcludedWorlds: Set<@Serializable(with = WorldSerializer::class) World> = emptySet(), + val remountPacketDelay: Duration = 40.ticks, + val fall: FallDamageConfig = FallDamageConfig(), + val time: TimeConfig = TimeConfig(), + ) { + val worlds = sections.map { it.world }.toSet() + } + + @Serializable + data class FallDamageConfig( + val maxSafeDist: Float = -1f, + val fallDistanceDamageScaler: Double = 0.01, + val startingDamage: Double = 1.0, + val hitDelay: Duration = 10.ticks, + val spawnParticles: Boolean = true + ) + + @Serializable + data class TimeConfig( + val updateInterval: Duration = 1800.seconds, + val mainWorld: World? = null, + val syncedWorlds: Map = emptyMap(), + ) +} diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/DeeperWorldPlugin.kt b/src/main/kotlin/com/mineinabyss/deeperworld/DeeperWorldPlugin.kt index 3b15233..0d27827 100644 --- a/src/main/kotlin/com/mineinabyss/deeperworld/DeeperWorldPlugin.kt +++ b/src/main/kotlin/com/mineinabyss/deeperworld/DeeperWorldPlugin.kt @@ -4,7 +4,6 @@ import com.comphenix.protocol.ProtocolLibrary import com.comphenix.protocol.ProtocolManager import com.github.shynixn.mccoroutine.bukkit.launch import com.mineinabyss.deeperworld.MinecraftConstants.FULL_DAY_TIME -import com.mineinabyss.deeperworld.config.DeeperConfig import com.mineinabyss.deeperworld.listeners.MovementListener import com.mineinabyss.deeperworld.listeners.PlayerListener import com.mineinabyss.deeperworld.player.FallingDamageManager @@ -15,9 +14,11 @@ import com.mineinabyss.deeperworld.synchronization.ContainerSyncListener import com.mineinabyss.deeperworld.synchronization.ExploitPreventionListener import com.mineinabyss.deeperworld.synchronization.SectionSyncListener import com.mineinabyss.deeperworld.world.WorldManagerImpl -import com.mineinabyss.idofront.platforms.IdofrontPlatforms -import com.mineinabyss.idofront.plugin.registerEvents -import com.mineinabyss.idofront.plugin.registerService +import com.mineinabyss.idofront.config.IdofrontConfig +import com.mineinabyss.idofront.config.config +import com.mineinabyss.idofront.platforms.Platforms +import com.mineinabyss.idofront.plugin.listeners +import com.mineinabyss.idofront.plugin.service import com.mineinabyss.idofront.time.ticks import kotlinx.coroutines.delay import org.bukkit.Material @@ -26,18 +27,18 @@ import org.bukkit.plugin.java.JavaPlugin val protocolManager: ProtocolManager = ProtocolLibrary.getProtocolManager() class DeeperWorldPlugin : JavaPlugin() { + lateinit var config: IdofrontConfig override fun onLoad() { - IdofrontPlatforms.load(this, "mineinabyss") + Platforms.load(this, "mineinabyss") } override fun onEnable() { - saveDefaultConfig() - registerService(WorldManagerImpl(config)) + config = config("config.yml") { fromPluginPath(loadDefault = true)} - DeeperConfig.load() + service(WorldManagerImpl()) + service(PlayerManagerImpl()) - registerService(PlayerManagerImpl()) - registerEvents( + listeners( MovementListener, PlayerListener, SectionSyncListener, @@ -49,8 +50,8 @@ class DeeperWorldPlugin : JavaPlugin() { DeeperCommandExecutor() // Initialize falling damage task - if (DeeperConfig.data.fall.maxSafeDist >= 0f && DeeperConfig.data.fall.fallDistanceDamageScaler >= 0.0) { - val hitDellay = DeeperConfig.data.fall.hitDelay.coerceAtLeast(1.ticks) + if (deeperConfig.fall.maxSafeDist >= 0f && deeperConfig.fall.fallDistanceDamageScaler >= 0.0) { + val hitDellay = deeperConfig.fall.hitDelay.coerceAtLeast(1.ticks) deeperWorld.launch { while (true) { server.onlinePlayers.forEach { @@ -62,13 +63,13 @@ class DeeperWorldPlugin : JavaPlugin() { } // Initialize time synchronization task - if (DeeperConfig.data.time.syncedWorlds.isNotEmpty()) { - DeeperConfig.data.time.mainWorld?.let { mainWorld -> - val updateInterval = DeeperConfig.data.time.updateInterval.coerceAtLeast(1.ticks) + if (deeperConfig.time.syncedWorlds.isNotEmpty()) { + deeperConfig.time.mainWorld?.let { mainWorld -> + val updateInterval = deeperConfig.time.updateInterval.coerceAtLeast(1.ticks) deeperWorld.launch { while (true) { val mainWorldTime = mainWorld.time - DeeperConfig.data.time.syncedWorlds.forEach { (world, offset) -> + deeperConfig.time.syncedWorlds.forEach { (world, offset) -> world.time = (mainWorldTime + offset) % FULL_DAY_TIME } delay(updateInterval) diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/config/DeeperConfig.kt b/src/main/kotlin/com/mineinabyss/deeperworld/config/DeeperConfig.kt deleted file mode 100644 index 116db9c..0000000 --- a/src/main/kotlin/com/mineinabyss/deeperworld/config/DeeperConfig.kt +++ /dev/null @@ -1,45 +0,0 @@ -@file:UseSerializers(DurationSerializer::class) - -package com.mineinabyss.deeperworld.config - -import com.mineinabyss.deeperworld.deeperWorld -import com.mineinabyss.deeperworld.services.WorldManager -import com.mineinabyss.deeperworld.world.section.Section -import com.mineinabyss.idofront.config.IdofrontConfig -import com.mineinabyss.idofront.config.ReloadScope -import com.mineinabyss.idofront.serialization.DurationSerializer -import com.mineinabyss.idofront.serialization.WorldSerializer -import com.mineinabyss.idofront.time.ticks -import kotlinx.serialization.Serializable -import kotlinx.serialization.UseSerializers -import org.bukkit.World -import kotlin.time.Duration - -object DeeperConfig : IdofrontConfig(deeperWorld, Data.serializer()) { - @Serializable - data class Data( - val sections: List
, - val damageOutsideSections: Double = 0.0, - val damageExcludedWorlds: Set<@Serializable(with = WorldSerializer::class) World> = emptySet(), - val remountPacketDelay: Duration = 40.ticks, - val fall: FallDamageConfig = FallDamageConfig(), - val time: TimeConfig = TimeConfig(), - ) { - val worlds = sections.map { it.world }.toSet() - } - - override fun ReloadScope.load() { - "Registering all sections with DeeperWorld" { - data.sections.forEachIndexed { i, section -> - data.sections.getOrNull(i - 1)?.let { prevSection -> - section.aboveKey = prevSection.key - prevSection.belowKey = section.key - } - WorldManager.registerSection( - section.key, - section - ) //TODO do we need to pass both section key and section? - } - } - } -} diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/config/FallDamageConfig.kt b/src/main/kotlin/com/mineinabyss/deeperworld/config/FallDamageConfig.kt deleted file mode 100644 index 1884099..0000000 --- a/src/main/kotlin/com/mineinabyss/deeperworld/config/FallDamageConfig.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:UseSerializers(DurationSerializer::class) - -package com.mineinabyss.deeperworld.config - -import com.mineinabyss.idofront.serialization.DurationSerializer -import com.mineinabyss.idofront.time.ticks -import kotlinx.serialization.Serializable -import kotlinx.serialization.UseSerializers -import kotlin.time.Duration - -@Serializable -class FallDamageConfig( - val maxSafeDist: Float = -1f, - val fallDistanceDamageScaler: Double = 0.01, - val startingDamage: Double = 1.0, - val hitDelay: Duration = 10.ticks, - val spawnParticles: Boolean = true -) diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/config/TimeConfig.kt b/src/main/kotlin/com/mineinabyss/deeperworld/config/TimeConfig.kt deleted file mode 100644 index 523d70f..0000000 --- a/src/main/kotlin/com/mineinabyss/deeperworld/config/TimeConfig.kt +++ /dev/null @@ -1,18 +0,0 @@ -@file:UseSerializers(WorldSerializer::class, DurationSerializer::class) - -package com.mineinabyss.deeperworld.config - -import com.mineinabyss.idofront.serialization.DurationSerializer -import com.mineinabyss.idofront.serialization.WorldSerializer -import kotlinx.serialization.Serializable -import kotlinx.serialization.UseSerializers -import org.bukkit.World -import kotlin.time.Duration -import kotlin.time.Duration.Companion.seconds - -@Serializable -class TimeConfig( - val updateInterval: Duration = 1800.seconds, - val mainWorld: World? = null, - val syncedWorlds: Map = emptyMap(), -) diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/movement/MovementHandler.kt b/src/main/kotlin/com/mineinabyss/deeperworld/movement/MovementHandler.kt index 0895fef..f935f62 100644 --- a/src/main/kotlin/com/mineinabyss/deeperworld/movement/MovementHandler.kt +++ b/src/main/kotlin/com/mineinabyss/deeperworld/movement/MovementHandler.kt @@ -1,12 +1,13 @@ package com.mineinabyss.deeperworld.movement -import com.mineinabyss.deeperworld.config.DeeperConfig +import com.mineinabyss.deeperworld.deeperConfig import com.mineinabyss.deeperworld.movement.transition.ConfigSectionChecker import com.mineinabyss.deeperworld.movement.transition.SectionTransition import com.mineinabyss.deeperworld.movement.transition.TransitionKind import com.mineinabyss.deeperworld.movement.transition.toEvent import com.mineinabyss.idofront.events.call -import com.mineinabyss.idofront.messaging.miniMsg +import com.mineinabyss.idofront.textcomponents.miniMsg +import net.kyori.adventure.text.format.NamedTextColor import net.kyori.adventure.title.Title import org.bukkit.GameMode import org.bukkit.Location @@ -38,18 +39,18 @@ object MovementHandler { //TODO abstract this away. Should instead do out of bounds action if out of bounds. private fun Player.applyOutOfBoundsDamage() { - if (DeeperConfig.data.damageOutsideSections > 0.0 - && location.world !in DeeperConfig.data.damageExcludedWorlds + if (deeperConfig.damageOutsideSections > 0.0 + && location.world !in deeperConfig.damageExcludedWorlds && (gameMode == GameMode.SURVIVAL || gameMode == GameMode.ADVENTURE) - && location.world in (DeeperConfig.data.worlds) + && location.world in deeperConfig.worlds ) { damage(0.01) //give a damage effect - health = (health - DeeperConfig.data.damageOutsideSections / 10) + health = (health - deeperConfig.damageOutsideSections / 10) .coerceIn(0.0, getAttribute(Attribute.GENERIC_MAX_HEALTH)?.value) //ignores armor showTitle( Title.title( - "You are not in a managed section".miniMsg(), - "You will take damage upon moving!".miniMsg(), + "You are not in a managed section".miniMsg().color(NamedTextColor.RED), + "You will take damage upon moving!".miniMsg().color(NamedTextColor.GRAY), Title.Times.times( 0.seconds.toJavaDuration(), 1.seconds.toJavaDuration(), diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/movement/SectionTeleportPacketAdapter.kt b/src/main/kotlin/com/mineinabyss/deeperworld/movement/SectionTeleportPacketAdapter.kt index 102574d..badbdbf 100644 --- a/src/main/kotlin/com/mineinabyss/deeperworld/movement/SectionTeleportPacketAdapter.kt +++ b/src/main/kotlin/com/mineinabyss/deeperworld/movement/SectionTeleportPacketAdapter.kt @@ -5,11 +5,10 @@ import com.comphenix.protocol.events.PacketAdapter import com.comphenix.protocol.events.PacketContainer import com.comphenix.protocol.events.PacketEvent import com.github.shynixn.mccoroutine.bukkit.launch -import com.mineinabyss.deeperworld.config.DeeperConfig import com.mineinabyss.deeperworld.datastructures.VehicleTree +import com.mineinabyss.deeperworld.deeperConfig import com.mineinabyss.deeperworld.deeperWorld import com.mineinabyss.deeperworld.protocolManager -import com.mineinabyss.idofront.time.inWholeTicks import com.mineinabyss.idofront.time.ticks import kotlinx.coroutines.delay import org.bukkit.entity.LivingEntity @@ -65,7 +64,7 @@ class SectionTeleportPacketAdapter( vehicleTree.root.value.fallDistance = oldFallDistance vehicleTree.root.value.velocity = oldVelocity - delay(DeeperConfig.data.remountPacketDelay) + delay(deeperConfig.remountPacketDelay) player.vehicle?.let { vehicle -> val playerVehicleID = vehicle.entityId diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/player/FallingDamageManager.kt b/src/main/kotlin/com/mineinabyss/deeperworld/player/FallingDamageManager.kt index 8e2e566..b2013d3 100644 --- a/src/main/kotlin/com/mineinabyss/deeperworld/player/FallingDamageManager.kt +++ b/src/main/kotlin/com/mineinabyss/deeperworld/player/FallingDamageManager.kt @@ -1,6 +1,6 @@ package com.mineinabyss.deeperworld.player -import com.mineinabyss.deeperworld.config.DeeperConfig +import com.mineinabyss.deeperworld.deeperConfig import com.mineinabyss.deeperworld.extensions.getRootVehicle import org.bukkit.GameMode.ADVENTURE import org.bukkit.GameMode.SURVIVAL @@ -10,22 +10,21 @@ import org.bukkit.entity.Player internal object FallingDamageManager { fun updateFallingDamage(player: Player) { val actualFallDistance = player.getRootVehicle()?.fallDistance ?: player.fallDistance - val fallConfig = DeeperConfig.data.fall - if (actualFallDistance > fallConfig.maxSafeDist + if (actualFallDistance > deeperConfig.fall.maxSafeDist && !player.isGliding && !player.allowFlight && !player.isDead && (player.gameMode == SURVIVAL || player.gameMode == ADVENTURE) ) { // Always deal a minimum of 1 damage, else the first damage tick could deal (almost) no damage - val damageToDeal = ((actualFallDistance - fallConfig.maxSafeDist) * fallConfig.fallDistanceDamageScaler) - .coerceAtLeast(fallConfig.startingDamage) + val damageToDeal = ((actualFallDistance - deeperConfig.fall.maxSafeDist) * deeperConfig.fall.fallDistanceDamageScaler) + .coerceAtLeast(deeperConfig.fall.startingDamage) player.damage(0.01) // Damage animation player.health = (player.health - damageToDeal).coerceAtLeast(0.0) - if (fallConfig.spawnParticles) + if (deeperConfig.fall.spawnParticles) player.world.spawnParticle( Particle.CLOUD, player.location.apply { y += player.velocity.y * 2 }, diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/services/PlayerManager.kt b/src/main/kotlin/com/mineinabyss/deeperworld/services/PlayerManager.kt index caa615d..df05770 100644 --- a/src/main/kotlin/com/mineinabyss/deeperworld/services/PlayerManager.kt +++ b/src/main/kotlin/com/mineinabyss/deeperworld/services/PlayerManager.kt @@ -1,13 +1,13 @@ package com.mineinabyss.deeperworld.services -import com.mineinabyss.idofront.plugin.getService +import com.mineinabyss.idofront.plugin.Services import org.bukkit.entity.Player /** * A small class used for handling temporary teleport prevention */ interface PlayerManager { - companion object : PlayerManager by getService() + companion object : PlayerManager by Services.get() fun playerCanTeleport(player: Player): Boolean fun setPlayerCanTeleport(player: Player, canTeleport: Boolean) diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/services/WorldManager.kt b/src/main/kotlin/com/mineinabyss/deeperworld/services/WorldManager.kt index c0acd39..7ecc572 100644 --- a/src/main/kotlin/com/mineinabyss/deeperworld/services/WorldManager.kt +++ b/src/main/kotlin/com/mineinabyss/deeperworld/services/WorldManager.kt @@ -2,7 +2,7 @@ package com.mineinabyss.deeperworld.services import com.mineinabyss.deeperworld.world.section.Section import com.mineinabyss.deeperworld.world.section.SectionKey -import com.mineinabyss.idofront.plugin.getService +import com.mineinabyss.idofront.plugin.Services import org.bukkit.Location import org.bukkit.World @@ -10,7 +10,7 @@ import org.bukkit.World * Manages sections within the world. */ interface WorldManager { - companion object : WorldManager by getService() + companion object : WorldManager by Services.get() /** * Given a location, return the Section it is within diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/world/WorldManagerImpl.kt b/src/main/kotlin/com/mineinabyss/deeperworld/world/WorldManagerImpl.kt index 117fbee..2d26816 100644 --- a/src/main/kotlin/com/mineinabyss/deeperworld/world/WorldManagerImpl.kt +++ b/src/main/kotlin/com/mineinabyss/deeperworld/world/WorldManagerImpl.kt @@ -6,9 +6,8 @@ import com.mineinabyss.deeperworld.world.section.Section import com.mineinabyss.deeperworld.world.section.SectionKey import org.bukkit.Location import org.bukkit.World -import org.bukkit.configuration.file.FileConfiguration -class WorldManagerImpl(config: FileConfiguration) : WorldManager { +class WorldManagerImpl : WorldManager { override val sections get() = sectionMap.values.toSet() private val sectionMap: MutableMap = HashMap()