From aa287f7f0eba9d425d1f1c5100cead1ea56a9085 Mon Sep 17 00:00:00 2001 From: emortal Date: Sun, 6 Mar 2022 17:32:37 +0000 Subject: [PATCH] idek --- build.gradle.kts | 16 ++++++++-------- gradle/wrapper/gradle-wrapper.properties | 2 +- .../emortal/holeymoley/HoleyMoleyExtension.kt | 1 + .../kotlin/emortal/holeymoley/command/doEvent.kt | 5 ++++- .../emortal/holeymoley/game/HoleyMoleyGame.kt | 1 - src/main/kotlin/emortal/holeymoley/item/Item.kt | 10 ++++++---- .../kotlin/emortal/holeymoley/item/Shovel.kt | 5 +++-- .../holeymoley/map/HoleyMoleyGenerator.kt | 2 -- .../kotlin/emortal/holeymoley/util/PotionUtil.kt | 9 --------- 9 files changed, 23 insertions(+), 28 deletions(-) delete mode 100644 src/main/kotlin/emortal/holeymoley/util/PotionUtil.kt diff --git a/build.gradle.kts b/build.gradle.kts index 5f3b14f..12017ef 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,18 +2,18 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { // Apply the Kotlin JVM plugin to add support for Kotlin. - id("org.jetbrains.kotlin.jvm") version "1.5.20" + id("org.jetbrains.kotlin.jvm") version "1.6.10" // Kotlinx serialization for any data format - kotlin("plugin.serialization") version "1.4.21" + kotlin("plugin.serialization") version "1.6.10" // Shade the plugin - id("com.github.johnrengelman.shadow") version "7.0.0" + id("com.github.johnrengelman.shadow") version "7.1.2" // Allow publishing `maven-publish` // Apply the application plugin to add support for building a jar java // Dokka documentation w/ kotlin - id("org.jetbrains.dokka") version "1.5.0" + id("org.jetbrains.dokka") version "1.6.10" } repositories { @@ -36,11 +36,11 @@ dependencies { // Use the Kotlin reflect library. compileOnly(kotlin("reflect")) - compileOnly("com.github.Minestom:Minestom:0bcfc39a9d") - compileOnly("com.github.EmortalMC:Immortal:a226a09091") + compileOnly("com.github.Minestom:Minestom:dab6ec6000") + compileOnly("com.github.EmortalMC:Immortal:81dfdace2b") // import kotlinx serialization - compileOnly("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2") + compileOnly("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2") } tasks.withType { useJUnitPlatform() @@ -82,7 +82,7 @@ java { } val compileKotlin: KotlinCompile by tasks -compileKotlin.kotlinOptions.jvmTarget = JavaVersion.VERSION_16.toString() +compileKotlin.kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString() compileKotlin.kotlinOptions { freeCompilerArgs = listOf("-Xinline-classes") diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 05679dc..41dfb87 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.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/emortal/holeymoley/HoleyMoleyExtension.kt b/src/main/kotlin/emortal/holeymoley/HoleyMoleyExtension.kt index 808f520..c904464 100644 --- a/src/main/kotlin/emortal/holeymoley/HoleyMoleyExtension.kt +++ b/src/main/kotlin/emortal/holeymoley/HoleyMoleyExtension.kt @@ -27,6 +27,7 @@ class HoleyMoleyExtension : Extension() { "holeymoley", "HoleyMoley".asMini(), true, + true, WhenToRegisterEvents.GAME_START, GameOptions( maxPlayers = 15, diff --git a/src/main/kotlin/emortal/holeymoley/command/doEvent.kt b/src/main/kotlin/emortal/holeymoley/command/doEvent.kt index b605640..f1d19ef 100644 --- a/src/main/kotlin/emortal/holeymoley/command/doEvent.kt +++ b/src/main/kotlin/emortal/holeymoley/command/doEvent.kt @@ -8,6 +8,9 @@ import world.cepi.kstom.command.arguments.suggest import world.cepi.kstom.command.kommand.Kommand object doEvent : Kommand({ + + onlyPlayers + val eventArg = ArgumentType.StringArray("event").suggest { Event.eventList.map { it.name } } @@ -19,6 +22,6 @@ object doEvent : Kommand({ return@syntax } - event.performEvent(sender.asPlayer().game!! as HoleyMoleyGame) + event.performEvent(player.game!! as HoleyMoleyGame) } }, "doevent") \ No newline at end of file diff --git a/src/main/kotlin/emortal/holeymoley/game/HoleyMoleyGame.kt b/src/main/kotlin/emortal/holeymoley/game/HoleyMoleyGame.kt index acf2572..2addc81 100644 --- a/src/main/kotlin/emortal/holeymoley/game/HoleyMoleyGame.kt +++ b/src/main/kotlin/emortal/holeymoley/game/HoleyMoleyGame.kt @@ -54,7 +54,6 @@ class HoleyMoleyGame(gameOptions: GameOptions) : PvpGame(gameOptions) { var eventLoopTask: Task? = null - val maxChests = 0.01 * (instance.getTag(MapCreator.mapSizeTag)!!).toDouble().pow(3) var uncoveredChests = mutableListOf() val blocksPlacedByPlayer = mutableListOf() diff --git a/src/main/kotlin/emortal/holeymoley/item/Item.kt b/src/main/kotlin/emortal/holeymoley/item/Item.kt index 4750fd4..9227040 100644 --- a/src/main/kotlin/emortal/holeymoley/item/Item.kt +++ b/src/main/kotlin/emortal/holeymoley/item/Item.kt @@ -6,6 +6,9 @@ import net.minestom.server.item.ItemStack import net.minestom.server.item.ItemStackBuilder import net.minestom.server.item.Material import net.minestom.server.tag.Tag +import world.cepi.kstom.adventure.noItalic +import world.cepi.kstom.item.item +import world.cepi.kstom.item.withMeta import java.util.concurrent.ThreadLocalRandom sealed class Item(val id: String, val material: Material, val rarity: Rarity, val itemCreate: (ItemStackBuilder) -> Unit = { }) { @@ -46,11 +49,10 @@ sealed class Item(val id: String, val material: Material, val rarity: Rarity, va fun createItemStack(): ItemStack { return ItemStack.builder(material) - .meta { - it.setTag(itemIdTag, id) - it + .withMeta { + setTag(itemIdTag, id) } - .lore(rarity.component.decoration(TextDecoration.ITALIC, false)) + .lore(rarity.component.noItalic()) .also { itemCreate.invoke(it) } .build() } diff --git a/src/main/kotlin/emortal/holeymoley/item/Shovel.kt b/src/main/kotlin/emortal/holeymoley/item/Shovel.kt index 86a11a9..a744a76 100644 --- a/src/main/kotlin/emortal/holeymoley/item/Shovel.kt +++ b/src/main/kotlin/emortal/holeymoley/item/Shovel.kt @@ -2,12 +2,13 @@ package emortal.holeymoley.item import net.minestom.server.item.Enchantment import net.minestom.server.item.Material +import world.cepi.kstom.item.withMeta object Shovel : Item( "shovel", Material.STONE_SHOVEL, Rarity.IMPOSSIBLE, - { it.meta { meta -> - meta.enchantment(Enchantment.EFFICIENCY, 5) + { it.withMeta { + enchantment(Enchantment.EFFICIENCY, 5) } } ) \ No newline at end of file diff --git a/src/main/kotlin/emortal/holeymoley/map/HoleyMoleyGenerator.kt b/src/main/kotlin/emortal/holeymoley/map/HoleyMoleyGenerator.kt index ccd8216..cd25b8f 100644 --- a/src/main/kotlin/emortal/holeymoley/map/HoleyMoleyGenerator.kt +++ b/src/main/kotlin/emortal/holeymoley/map/HoleyMoleyGenerator.kt @@ -30,7 +30,5 @@ class HoleyMoleyGenerator(private val mapSize: Int) : ChunkGenerator { } } - override fun fillBiomes(biomes: Array, chunkX: Int, chunkZ: Int) = Arrays.fill(biomes, Biome.PLAINS) - override fun getPopulators(): MutableList? = null } \ No newline at end of file diff --git a/src/main/kotlin/emortal/holeymoley/util/PotionUtil.kt b/src/main/kotlin/emortal/holeymoley/util/PotionUtil.kt deleted file mode 100644 index 0f350b4..0000000 --- a/src/main/kotlin/emortal/holeymoley/util/PotionUtil.kt +++ /dev/null @@ -1,9 +0,0 @@ -package emortal.holeymoley.util - -import net.minestom.server.potion.CustomPotionEffect -import net.minestom.server.potion.Potion -import net.minestom.server.potion.PotionEffect - -fun CustomPotionEffect.asPotion(): Potion { - return Potion(PotionEffect.fromId(id.toInt())!!, amplifier, duration, showParticles(), showIcon(), isAmbient) -} \ No newline at end of file