From 0f196f59c6a4cb76ab8409da62ff1f35505f94a8 Mon Sep 17 00:00:00 2001 From: Dico Karssiens Date: Sun, 11 Nov 2018 14:06:45 +0000 Subject: Changes I made before breaking my local repository. Hoping this works. --- .../dico/parcels2/defaultimpl/ParcelWorldImpl.kt | 150 ++++++++++----------- 1 file changed, 75 insertions(+), 75 deletions(-) (limited to 'src/main/kotlin/io/dico/parcels2/defaultimpl/ParcelWorldImpl.kt') diff --git a/src/main/kotlin/io/dico/parcels2/defaultimpl/ParcelWorldImpl.kt b/src/main/kotlin/io/dico/parcels2/defaultimpl/ParcelWorldImpl.kt index 531a25f..6ce4f26 100644 --- a/src/main/kotlin/io/dico/parcels2/defaultimpl/ParcelWorldImpl.kt +++ b/src/main/kotlin/io/dico/parcels2/defaultimpl/ParcelWorldImpl.kt @@ -1,75 +1,75 @@ -@file:Suppress("CanBePrimaryConstructorProperty", "UsePropertyAccessSyntax") - -package io.dico.parcels2.defaultimpl - -import io.dico.parcels2.* -import io.dico.parcels2.options.RuntimeWorldOptions -import io.dico.parcels2.storage.Storage -import kotlinx.coroutines.CoroutineScope -import org.bukkit.GameRule -import org.bukkit.World -import org.joda.time.DateTime -import java.util.UUID - -class ParcelWorldImpl( - val plugin: ParcelsPlugin, - override val world: World, - override val generator: ParcelGenerator, - override var options: RuntimeWorldOptions, - containerFactory: ParcelContainerFactory -) : ParcelWorld, ParcelWorldId, ParcelContainer, ParcelLocator { - override val id: ParcelWorldId get() = this - override val uid: UUID? get() = world.uid - - override val storage get() = plugin.storage - override val globalPrivileges get() = plugin.globalPrivileges - - init { - if (generator.world != world) { - throw IllegalArgumentException() - } - } - - override val name: String = world.name!! - override val container: ParcelContainer = containerFactory(this) - override val locator: ParcelLocator - override val blockManager: ParcelBlockManager - - init { - val (locator, blockManager) = generator.makeParcelLocatorAndBlockManager(plugin.parcelProvider, container, plugin, plugin.jobDispatcher) - this.locator = locator - this.blockManager = blockManager - enforceOptions() - } - - fun enforceOptions() { - if (options.dayTime) { - world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false) - world.setTime(6000) - } - - if (options.noWeather) { - world.setStorm(false) - world.setThundering(false) - world.weatherDuration = Int.MAX_VALUE - } - - world.setGameRule(GameRule.DO_TILE_DROPS, options.doTileDrops) - } - - // Accessed by ParcelProviderImpl - override var creationTime: DateTime? = null - - - override fun getParcelAt(x: Int, z: Int): Parcel? = locator.getParcelAt(x, z) - - override fun getParcelIdAt(x: Int, z: Int): ParcelId? = locator.getParcelIdAt(x, z) - - override fun getParcelById(x: Int, z: Int): Parcel? = container.getParcelById(x, z) - - override fun getParcelById(id: ParcelId): Parcel? = container.getParcelById(id) - - override fun nextEmptyParcel(): Parcel? = container.nextEmptyParcel() - - override fun toString() = parcelWorldIdToString() -} +@file:Suppress("CanBePrimaryConstructorProperty", "UsePropertyAccessSyntax") + +package io.dico.parcels2.defaultimpl + +import io.dico.parcels2.* +import io.dico.parcels2.options.RuntimeWorldOptions +import io.dico.parcels2.storage.Storage +import kotlinx.coroutines.CoroutineScope +import org.bukkit.GameRule +import org.bukkit.World +import org.joda.time.DateTime +import java.util.UUID + +class ParcelWorldImpl( + val plugin: ParcelsPlugin, + override val world: World, + override val generator: ParcelGenerator, + override var options: RuntimeWorldOptions, + containerFactory: ParcelContainerFactory +) : ParcelWorld, ParcelWorldId, ParcelContainer, ParcelLocator { + override val id: ParcelWorldId get() = this + override val uid: UUID? get() = world.uid + + override val storage get() = plugin.storage + override val globalPrivileges get() = plugin.globalPrivileges + + init { + if (generator.world != world) { + throw IllegalArgumentException() + } + } + + override val name: String = world.name!! + override val container: ParcelContainer = containerFactory(this) + override val locator: ParcelLocator + override val blockManager: ParcelBlockManager + + init { + val (locator, blockManager) = generator.makeParcelLocatorAndBlockManager(plugin.parcelProvider, container, plugin, plugin.jobDispatcher) + this.locator = locator + this.blockManager = blockManager + enforceOptions() + } + + fun enforceOptions() { + if (options.dayTime) { + world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false) + world.setTime(6000) + } + + if (options.noWeather) { + world.setStorm(false) + world.setThundering(false) + world.weatherDuration = Int.MAX_VALUE + } + + world.setGameRule(GameRule.DO_TILE_DROPS, options.doTileDrops) + } + + // Accessed by ParcelProviderImpl + override var creationTime: DateTime? = null + + + override fun getParcelAt(x: Int, z: Int): Parcel? = locator.getParcelAt(x, z) + + override fun getParcelIdAt(x: Int, z: Int): ParcelId? = locator.getParcelIdAt(x, z) + + override fun getParcelById(x: Int, z: Int): Parcel? = container.getParcelById(x, z) + + override fun getParcelById(id: ParcelId): Parcel? = container.getParcelById(id) + + override fun nextEmptyParcel(): Parcel? = container.nextEmptyParcel() + + override fun toString() = parcelWorldIdToString() +} -- cgit v1.2.3 From a475226ffcf17a7327b78e5c1e6ba6ac0dfd10c7 Mon Sep 17 00:00:00 2001 From: Dico Karssiens Date: Sun, 6 Jan 2019 12:02:34 +0000 Subject: Perform some fixes --- .../dico/parcels2/defaultimpl/ParcelWorldImpl.kt | 150 ++++++++++----------- 1 file changed, 75 insertions(+), 75 deletions(-) (limited to 'src/main/kotlin/io/dico/parcels2/defaultimpl/ParcelWorldImpl.kt') diff --git a/src/main/kotlin/io/dico/parcels2/defaultimpl/ParcelWorldImpl.kt b/src/main/kotlin/io/dico/parcels2/defaultimpl/ParcelWorldImpl.kt index 6ce4f26..cb322d4 100644 --- a/src/main/kotlin/io/dico/parcels2/defaultimpl/ParcelWorldImpl.kt +++ b/src/main/kotlin/io/dico/parcels2/defaultimpl/ParcelWorldImpl.kt @@ -1,75 +1,75 @@ -@file:Suppress("CanBePrimaryConstructorProperty", "UsePropertyAccessSyntax") - -package io.dico.parcels2.defaultimpl - -import io.dico.parcels2.* -import io.dico.parcels2.options.RuntimeWorldOptions -import io.dico.parcels2.storage.Storage -import kotlinx.coroutines.CoroutineScope -import org.bukkit.GameRule -import org.bukkit.World -import org.joda.time.DateTime -import java.util.UUID - -class ParcelWorldImpl( - val plugin: ParcelsPlugin, - override val world: World, - override val generator: ParcelGenerator, - override var options: RuntimeWorldOptions, - containerFactory: ParcelContainerFactory -) : ParcelWorld, ParcelWorldId, ParcelContainer, ParcelLocator { - override val id: ParcelWorldId get() = this - override val uid: UUID? get() = world.uid - - override val storage get() = plugin.storage - override val globalPrivileges get() = plugin.globalPrivileges - - init { - if (generator.world != world) { - throw IllegalArgumentException() - } - } - - override val name: String = world.name!! - override val container: ParcelContainer = containerFactory(this) - override val locator: ParcelLocator - override val blockManager: ParcelBlockManager - - init { - val (locator, blockManager) = generator.makeParcelLocatorAndBlockManager(plugin.parcelProvider, container, plugin, plugin.jobDispatcher) - this.locator = locator - this.blockManager = blockManager - enforceOptions() - } - - fun enforceOptions() { - if (options.dayTime) { - world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false) - world.setTime(6000) - } - - if (options.noWeather) { - world.setStorm(false) - world.setThundering(false) - world.weatherDuration = Int.MAX_VALUE - } - - world.setGameRule(GameRule.DO_TILE_DROPS, options.doTileDrops) - } - - // Accessed by ParcelProviderImpl - override var creationTime: DateTime? = null - - - override fun getParcelAt(x: Int, z: Int): Parcel? = locator.getParcelAt(x, z) - - override fun getParcelIdAt(x: Int, z: Int): ParcelId? = locator.getParcelIdAt(x, z) - - override fun getParcelById(x: Int, z: Int): Parcel? = container.getParcelById(x, z) - - override fun getParcelById(id: ParcelId): Parcel? = container.getParcelById(id) - - override fun nextEmptyParcel(): Parcel? = container.nextEmptyParcel() - - override fun toString() = parcelWorldIdToString() -} +@file:Suppress("CanBePrimaryConstructorProperty", "UsePropertyAccessSyntax") + +package io.dico.parcels2.defaultimpl + +import io.dico.parcels2.* +import io.dico.parcels2.options.RuntimeWorldOptions +import io.dico.parcels2.storage.Storage +import kotlinx.coroutines.CoroutineScope +import org.bukkit.GameRule +import org.bukkit.World +import org.joda.time.DateTime +import java.util.UUID + +class ParcelWorldImpl( + val plugin: ParcelsPlugin, + override val world: World, + override val generator: ParcelGenerator, + override var options: RuntimeWorldOptions, + containerFactory: ParcelContainerFactory +) : ParcelWorld, ParcelWorldId, ParcelContainer, ParcelLocator { + override val id: ParcelWorldId get() = this + override val uid: UUID? get() = world.uid + + override val storage get() = plugin.storage + override val globalPrivileges get() = plugin.globalPrivileges + + init { + if (generator.world != world) { + throw IllegalArgumentException() + } + } + + override val name: String = world.name!! + override val container: ParcelContainer = containerFactory(this) + override val locator: ParcelLocator + override val blockManager: ParcelBlockManager + + init { + val (locator, blockManager) = generator.makeParcelLocatorAndBlockManager(plugin.parcelProvider, container, plugin, plugin.jobDispatcher) + this.locator = locator + this.blockManager = blockManager + enforceOptions() + } + + fun enforceOptions() { + if (options.dayTime) { + world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false) + world.setTime(6000) + } + + if (options.noWeather) { + world.setStorm(false) + world.setThundering(false) + world.weatherDuration = Int.MAX_VALUE + } + + world.setGameRule(GameRule.DO_TILE_DROPS, options.doTileDrops) + } + + // Accessed by ParcelProviderImpl + override var creationTime: DateTime? = null + + + override fun getParcelAt(x: Int, z: Int): Parcel? = locator.getParcelAt(x, z) + + override fun getParcelIdAt(x: Int, z: Int): ParcelId? = locator.getParcelIdAt(x, z) + + override fun getParcelById(x: Int, z: Int): Parcel? = container.getParcelById(x, z) + + override fun getParcelById(id: ParcelId): Parcel? = container.getParcelById(id) + + override suspend fun nextEmptyParcel(): Parcel? = container.nextEmptyParcel() + + override fun toString() = parcelWorldIdToString() +} -- cgit v1.2.3