diff --git a/build.gradle.kts b/build.gradle.kts index 06a207f..6f273d2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ val kotlinVersion = "1.9.0" val kotlinBukkitAPIVersion = "1.0.0.2" group = "tech.carcadex.kotlinbukkitkit" -version = "0.0.2" +version = "0.0.3" repositories { mavenLocal() @@ -86,11 +86,8 @@ tasks.getByName("patchPluginXml

-

Demonstration


- - """.trimIndent()) diff --git a/scripts/generate-1.13-items.main.kts b/scripts/generate-1.13-items.main.kts deleted file mode 100644 index 7c79fb7..0000000 --- a/scripts/generate-1.13-items.main.kts +++ /dev/null @@ -1,124 +0,0 @@ -@file:DependsOn("io.ktor:ktor-client-core:1.4.0") -@file:DependsOn("io.ktor:ktor-client-core-jvm:1.4.0") -@file:DependsOn("io.ktor:ktor-client-apache:1.4.0") -@file:DependsOn("io.ktor:ktor-client-json-jvm:1.4.0") -@file:DependsOn("io.ktor:ktor-client-gson:1.4.0") - -@file:DependsOn("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9") - -// HTML -@file:DependsOn("it.skrape:skrapeit-core:1.0.0-alpha6") -@file:DependsOn("io.github.rybalkinsd:kohttp:0.12.0") -@file:DependsOn("org.jsoup:jsoup:1.13.1") - -// IMAGE RESIZE -@file:DependsOn("com.sksamuel.scrimage:scrimage-core:4.0.6") -@file:DependsOn("com.sksamuel.scrimage:scrimage-formats-extra:4.0.6") -@file:DependsOn("ar.com.hjg:pngj:2.1.0") -@file:DependsOn("com.github.zh79325:open-gif:1.0.4") - -// CODE GENERATIOn -@file:DependsOn("com.squareup:kotlinpoet:0.6.0") - -import com.sksamuel.scrimage.ImmutableImage -import com.sksamuel.scrimage.ScaleMethod -import com.sksamuel.scrimage.nio.PngWriter -import com.squareup.kotlinpoet.FileSpec -import com.squareup.kotlinpoet.TypeSpec -import io.ktor.client.* -import io.ktor.client.engine.apache.* -import io.ktor.client.request.* -import it.skrape.core.htmlDocument -import it.skrape.extract -import it.skrape.skrape -import kotlinx.coroutines.flow.asFlow -import kotlinx.coroutines.flow.collect -import kotlinx.coroutines.flow.onEach -import kotlinx.coroutines.runBlocking -import java.awt.Color -import java.awt.image.BufferedImage -import java.io.File - -data class Item( - val id: String, - val image: String, -) - -var items = skrape { - val url = "https://www.deadmap.com/idlist" - - extract { - htmlDocument { - findFirst("#idlist").findAll("tr") { - map { - val img = it.findFirst("img") - .attribute("src") - .replace(" ", "%20") - - val id = it.findFirst("i").text - - Item(id.removePrefix("minecraft:"), "https://www.deadmap.com/$img") - } - } - } - } -} - -println(items.joinToString("\n")) - -// FIXERS -val fixers = mapOf( - "staned" to "stained", - "dandelion_yellow" to "yellow_dye" -) - -items = items.map { it.copy(fixers.entries.fold(it.id) { id, entry -> id.replace(entry.key, entry.value) }) } - -runBlocking { - val client = HttpClient(Apache) - - val iconsFolder = File("../src/main/resources/assets/items-13").canonicalFile - iconsFolder.mkdirs() - - items - .withIndex() - .asFlow() - .onEach { (index, item) -> - val (name, imageUrl) = item - println("Downloading item: $name ($index/${items.size - 1})") - - val imageBytes = client.get(imageUrl) - - val image = ImmutableImage.loader() - .type(BufferedImage.TYPE_INT_ARGB) - .fromBytes(imageBytes) - .run { - val tags = metadata.tags() - val width = tags.first { it.name.contains("Width") }.rawValue.toInt() - val height = tags.first { it.name.contains("Height") }.rawValue.toInt() - - if(width > 32 || height > 32) { - scaleTo(32, 32, ScaleMethod.FastScale) - } else this - } - - image.output(PngWriter.NoCompression, File(iconsFolder, "$name.png")) - println("Complete download and resize: $name ($index/${items.size - 1})") - } - .collect() -} - -println("Generating MinecrateItem13 Enumeration") - -FileSpec.builder("br.com.devsrsouza.kotlinbukkitapi.tooling.menu", "MinecraftItem13") - .addType( - TypeSpec.enumBuilder("MinecraftItem13") - .apply { - for ((id, _) in items) { - addEnumConstant(id.toUpperCase()) - } - } - .build() - ) - .build() - .writeTo(File("../src/main/kotlin/").canonicalFile) \ No newline at end of file diff --git a/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/Versions.kt b/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/Versions.kt index 8356027..9789d3a 100644 --- a/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/Versions.kt +++ b/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/Versions.kt @@ -4,14 +4,16 @@ object Versions { val `1-0-0-4-SNAPSHOT` = KotlinBukkitAPIVersion("1.0.0.4-SNAPSHOT") val `1-0-0-3-SNAPSHOT` = KotlinBukkitAPIVersion("1.0.0.3-SNAPSHOT") val `1-0-0-3` = KotlinBukkitAPIVersion("1.0.0.3") + val `1-0-1-0` = KotlinBukkitAPIVersion("1.0.1.0") val ALL = arrayOf( `1-0-0-4-SNAPSHOT`, `1-0-0-3`, - `1-0-0-3-SNAPSHOT` + `1-0-0-3-SNAPSHOT`, + `1-0-1-0` ) - val LAST = `1-0-0-3` + val LAST = `1-0-1-0` val visitorAll = ALL.associate { it.version to it } @@ -48,6 +50,9 @@ data class KotlinBukkitAPIVersion( "com.github.cryptomorin:XSeries:9.2.0" ) + val dependenciesImplementation = listOf( + "org.jetbrains.kotlin:kotlin-reflect:1.9.21", + ) val dependenciesCompileOnly = listOf( "org.jetbrains:annotations:24.0.0", ) diff --git a/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/bukkit/PluginList.kt b/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/bukkit/PluginList.kt index c9ed6c6..63530d0 100644 --- a/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/bukkit/PluginList.kt +++ b/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/bukkit/PluginList.kt @@ -18,14 +18,14 @@ val ALL_PLUGINS = listOf( + listOf(v1_13, v1_14, v1_15, v1_16, v1_17, v1_18, v1_19).asPluginVersion("7.2.14-SNAPSHOT") { setOf("$worldEdit:worldedit-core:$it", "$worldEdit:worldedit-bukkit:$it") } + listOf(v1_20).asPluginVersion("7.3.0-SNAPSHOT") { setOf("$worldEdit:worldedit-core:$it", "$worldEdit:worldedit-bukkit:$it") } , - setOf("http://maven.sk89q.com/repo/") + setOf("https://repo.minebench.de/") ), Plugin( "WorldGuard", listOf(v1_8, v1_9, v1_12).asPluginVersion("6.1") { setOf("com.sk89q:worldguard:$it") } - + listOf(v1_13, v1_14, v1_15, v1_16, v1_17, v1_18, v1_19, v1_20).asPluginVersion("7.0.4-SNAPSHOT") { setOf("com.sk89q.worldguard:worldguard-core:$it", "com.sk89q.worldguard:worldguard-bukkit:$it") } + + listOf(v1_13, v1_14, v1_15, v1_16, v1_17, v1_18, v1_19, v1_20).asPluginVersion("7.0.1-SNAPSHOT") { setOf("com.sk89q.worldguard:worldguard-core:$it", "com.sk89q.worldguard:worldguard-bukkit:$it") } , - setOf("http://maven.sk89q.com/repo/") + setOf("https://repo.minebench.de/") ), Plugin( "Citizens", @@ -90,6 +90,11 @@ val ALL_PLUGINS = listOf( allVersion("4.3.1") { setOf("com.onarandombox.multiversecore:Multiverse-Core:$it") }, setOf("https://repo.onarandombox.com/content/groups/public/") ), + Plugin( + "ItemsAdder", + allVersion("3.6.1") { setOf("com.github.LoneDev6:api-itemsadder:$it") }, + setOf("https://jitpack.io") + ), ) inline fun allVersion(version: String, dependencies: (String) -> Set): List = ServerVersion.values().map { PluginVersion(version, it, dependencies(version)) } diff --git a/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/bukkit/ServerAPI.kt b/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/bukkit/ServerAPI.kt index 831f0c2..89d0471 100644 --- a/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/bukkit/ServerAPI.kt +++ b/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/bukkit/ServerAPI.kt @@ -18,7 +18,8 @@ val ServerAPI.dependencies: List get() { ServerVersion.v1_17 -> "1.17.1-R0.1-SNAPSHOT" ServerVersion.v1_18 -> "1.18.2-R0.1-SNAPSHOT" ServerVersion.v1_19 -> "1.19.4-R0.1-SNAPSHOT" - ServerVersion.v1_20 -> "1.20.4-R0.1-SNAPSHOT" + ServerVersion.v1_20 -> "1.20.6-R0.1-SNAPSHOT" + ServerVersion.v1_21 -> "1.21-R0.1-SNAPSHOT" } val dependency = when(serverType) { diff --git a/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/bukkit/ServerVersion.kt b/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/bukkit/ServerVersion.kt index e9954db..0e1043c 100644 --- a/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/bukkit/ServerVersion.kt +++ b/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/bukkit/ServerVersion.kt @@ -11,7 +11,8 @@ enum class ServerVersion(val displayName: String, val maxVersion: String, val mi v1_17("1.17", "1.17.1", 17), v1_18("1.18", "1.18.2", 18), v1_19("1.19", "1.19.4", 19), - v1_20("1.20", "1.20.4", 20),; + v1_20("1.20", "1.20.6", 20), + v1_21("1.21", "1.21", 20),; override fun toString(): String { diff --git a/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/creator/GradleBuilder.kt b/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/creator/GradleBuilder.kt index bacadeb..fd17b4e 100644 --- a/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/creator/GradleBuilder.kt +++ b/src/main/kotlin/tech/carcadex/kotlinbukkitkit/tooling/wizard/creator/GradleBuilder.kt @@ -26,9 +26,11 @@ fun generateGradleBuildFileContent( config: KBAPIModuleConfig ): String = with(config) { val kbapiDependencies = kbAPIVersion.dependencies - .dependenciesAsGradle(if (config.serverVersion.minor >= 16) "library" else "implementation") + .dependenciesAsGradle(if (config.serverVersion.minor >= 16 && !config.kbAPIVersion.version.endsWith("SNAPSHOT")) "library" else "implementation") val kbapiDependenciesCompileOnly = kbAPIVersion.dependenciesCompileOnly .dependenciesAsGradle("compileOnly") + val kbapiDependenciesImplementation = kbAPIVersion.dependenciesCompileOnly + .dependenciesAsGradle("implementation") val kspModules = kbAPIVersion.kspModules.dependenciesAsGradle("ksp") val kspDependencies = kbAPIVersion.kspModules.dependenciesAsGradle() @@ -54,6 +56,7 @@ fun generateGradleBuildFileContent( return """ |// More about the setup here: https://red-tea.gitbook.io/kotlinbukkitkit + | |plugins { | kotlin("jvm") version "${kbAPIVersion.kotlinVersion}" | kotlin("plugin.serialization") version "${kbAPIVersion.kotlinVersion}" @@ -88,6 +91,7 @@ fun generateGradleBuildFileContent( | //kotlinbukkitapi |$kbapiDependencies |$kbapiDependenciesCompileOnly + |$kbapiDependenciesImplementation | | //ksp |$kspDependencies @@ -107,11 +111,11 @@ fun generateGradleBuildFileContent( |} | |tasks { - | shadowJar { - | dependencies { - | exclude(dependency("org.jetbrains:*:*")) - | } - | } + |// shadowJar { + |// minimize { + |// exclude(dependency("org.jetbrains:.*:.*")) + |// } + |// } | runServer { | minecraftVersion("${config.serverVersion.maxVersion}") | } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 55dbf7c..cce1b2a 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -3,8 +3,6 @@ KotlinBukkitKit Tooling Denis Istratov - com.intellij.modules.platform org.jetbrains.kotlin com.intellij.modules.lang diff --git a/src/main/resources/assets.zip b/src/main/resources/assets.zip deleted file mode 100644 index cef55bd..0000000 Binary files a/src/main/resources/assets.zip and /dev/null differ diff --git a/src/main/resources/assets/fonts/Minecraftia-Regular.ttf b/src/main/resources/assets/fonts/Minecraftia-Regular.ttf deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/resources/assets/heads/question.png b/src/main/resources/assets/heads/question.png deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/resources/assets/icons/bukkript.svg b/src/main/resources/assets/icons/bukkript.svg deleted file mode 100644 index 29830bc..0000000 --- a/src/main/resources/assets/icons/bukkript.svg +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/assets/icons/folderBukkript.svg b/src/main/resources/assets/icons/folderBukkript.svg deleted file mode 100644 index 4c627ce..0000000 --- a/src/main/resources/assets/icons/folderBukkript.svg +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/assets/icons/folderPlugins.svg b/src/main/resources/assets/icons/folderPlugins.svg deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/resources/assets/icons/folderScript.svg b/src/main/resources/assets/icons/folderScript.svg deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/resources/assets/icons/kotlinbukkitapi-icon.svg b/src/main/resources/assets/icons/kotlinbukkitapi-icon.svg deleted file mode 100644 index 3afaacc..0000000 --- a/src/main/resources/assets/icons/kotlinbukkitapi-icon.svg +++ /dev/null @@ -1 +0,0 @@ -kotlinbukkitapi-logo \ No newline at end of file diff --git a/src/main/resources/fileTemplates/internal/Bukkript Script.bk.kts.ft b/src/main/resources/fileTemplates/internal/Bukkript Script.bk.kts.ft deleted file mode 100644 index e69de29..0000000