From 42dec2fea54ce40a44beb98ce880e3f7bc38197c Mon Sep 17 00:00:00 2001 From: Lilly <46890129+RainbowDashLabs@users.noreply.github.com> Date: Thu, 30 May 2024 10:47:54 +0200 Subject: [PATCH 01/21] Add validation for main class and api version --- .../pluginyml/bukkit/BukkitPlugin.kt | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt index ece5705..39ae1f9 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt @@ -27,13 +27,21 @@ package net.minecrell.pluginyml.bukkit import net.minecrell.pluginyml.InvalidPluginDescriptionException import net.minecrell.pluginyml.PlatformPlugin import net.minecrell.pluginyml.collectLibraries +import net.minecrell.pluginyml.paper.PaperPlugin import org.gradle.api.Project import org.gradle.api.artifacts.result.ResolvedComponentResult class BukkitPlugin : PlatformPlugin("Bukkit", "plugin.yml") { companion object { - @JvmStatic private val VALID_NAME = Regex("^[A-Za-z0-9 _.-]+$") + @JvmStatic + private val VALID_NAME = Regex("^[A-Za-z0-9 _.-]+$") + + @JvmStatic + private val VALID_API_VERSION = Regex("^1\\.[0-9]+$") + + @JvmStatic + private val INVALID_NAMESPACES = listOf("net.minecraft.", "org.bukkit.", "io.papermc.", "com.destroystokoyo.paper.", "org.spigotmc") } override fun createExtension(project: Project) = BukkitPluginDescription(project) @@ -53,12 +61,17 @@ class BukkitPlugin : PlatformPlugin("Bukkit", "plugin.y override fun validate(description: BukkitPluginDescription) { val name = description.name ?: throw InvalidPluginDescriptionException("Plugin name is not set") if (!VALID_NAME.matches(name)) throw InvalidPluginDescriptionException("Invalid plugin name: should match $VALID_NAME") + if (description.apiVersion != null) { + val apiVersion = description.apiVersion!! + if (!VALID_API_VERSION.matches(apiVersion)) throw InvalidPluginDescriptionException("Invalid api version: should match $VALID_API_VERSION") + if (apiVersion < "1.13") throw InvalidPluginDescriptionException("Invalid api version: should be at least 1.13") + } if (description.version.isNullOrEmpty()) throw InvalidPluginDescriptionException("Plugin version is not set") val main = description.main ?: throw InvalidPluginDescriptionException("Main class is not defined") if (main.isEmpty()) throw InvalidPluginDescriptionException("Main class cannot be empty") - if (main.startsWith("org.bukkit.")) throw InvalidPluginDescriptionException("Main may not be within the org.bukkit namespace") + validateNamespace(main, "Main") for (command in description.commands) { if (command.name.contains(':')) throw InvalidPluginDescriptionException("Command '${command.name}' cannot contain ':'") @@ -72,4 +85,11 @@ class BukkitPlugin : PlatformPlugin("Bukkit", "plugin.y } } + private fun validateNamespace(namespace: String, name: String) { + for (invalidNamespace in INVALID_NAMESPACES) { + if (namespace.startsWith(invalidNamespace)) { + throw InvalidPluginDescriptionException("$name may not be within the $invalidNamespace namespace") + } + } + } } From a8ca4861ee0a34ddfe3d944198666f3ab7355b3b Mon Sep 17 00:00:00 2001 From: Lilly <46890129+RainbowDashLabs@users.noreply.github.com> Date: Thu, 30 May 2024 10:52:18 +0200 Subject: [PATCH 02/21] remove unused import --- src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt index 39ae1f9..83d19c1 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt @@ -27,7 +27,6 @@ package net.minecrell.pluginyml.bukkit import net.minecrell.pluginyml.InvalidPluginDescriptionException import net.minecrell.pluginyml.PlatformPlugin import net.minecrell.pluginyml.collectLibraries -import net.minecrell.pluginyml.paper.PaperPlugin import org.gradle.api.Project import org.gradle.api.artifacts.result.ResolvedComponentResult @@ -36,10 +35,8 @@ class BukkitPlugin : PlatformPlugin("Bukkit", "plugin.y companion object { @JvmStatic private val VALID_NAME = Regex("^[A-Za-z0-9 _.-]+$") - @JvmStatic private val VALID_API_VERSION = Regex("^1\\.[0-9]+$") - @JvmStatic private val INVALID_NAMESPACES = listOf("net.minecraft.", "org.bukkit.", "io.papermc.", "com.destroystokoyo.paper.", "org.spigotmc") } From 121032b706e7da5c207c97aef5c1ea7359f0501d Mon Sep 17 00:00:00 2001 From: Lilly <46890129+RainbowDashLabs@users.noreply.github.com> Date: Tue, 4 Jun 2024 20:52:00 +0200 Subject: [PATCH 03/21] Account for minor versions from 1.20.5 onwards --- .../minecrell/pluginyml/bukkit/BukkitPlugin.kt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt index 83d19c1..490b52c 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt @@ -35,10 +35,13 @@ class BukkitPlugin : PlatformPlugin("Bukkit", "plugin.y companion object { @JvmStatic private val VALID_NAME = Regex("^[A-Za-z0-9 _.-]+$") + @JvmStatic private val VALID_API_VERSION = Regex("^1\\.[0-9]+$") + @JvmStatic - private val INVALID_NAMESPACES = listOf("net.minecraft.", "org.bukkit.", "io.papermc.", "com.destroystokoyo.paper.", "org.spigotmc") + private val INVALID_NAMESPACES = + listOf("net.minecraft.", "org.bukkit.", "io.papermc.", "com.destroystokoyo.paper.", "org.spigotmc") } override fun createExtension(project: Project) = BukkitPluginDescription(project) @@ -60,8 +63,16 @@ class BukkitPlugin : PlatformPlugin("Bukkit", "plugin.y if (!VALID_NAME.matches(name)) throw InvalidPluginDescriptionException("Invalid plugin name: should match $VALID_NAME") if (description.apiVersion != null) { val apiVersion = description.apiVersion!! - if (!VALID_API_VERSION.matches(apiVersion)) throw InvalidPluginDescriptionException("Invalid api version: should match $VALID_API_VERSION") - if (apiVersion < "1.13") throw InvalidPluginDescriptionException("Invalid api version: should be at least 1.13") + val splitVersion = apiVersion.split("\\.").map { v -> v.toInt() } + if (splitVersion.size == 2) { + if (!VALID_API_VERSION.matches(apiVersion)) throw InvalidPluginDescriptionException("Invalid api version: should match $VALID_API_VERSION") + if (apiVersion < "1.13") throw InvalidPluginDescriptionException("Invalid api version: should be at least 1.13") + } else if (splitVersion.size == 3) { + if (splitVersion[1] < 20) throw InvalidPluginDescriptionException("Invalid api version: Minor versions are not supported before 1.20.5") + if (splitVersion[1] == 20 && splitVersion[2] < 5) throw InvalidPluginDescriptionException("Invalid api version: Minor versions are not supported before 1.20.5") + } else { + throw InvalidPluginDescriptionException("Invalid api version: $VALID_API_VERSION") + } } if (description.version.isNullOrEmpty()) throw InvalidPluginDescriptionException("Plugin version is not set") From 4d06aaeda3588f5e764563fe19a5090ccf7f5cc7 Mon Sep 17 00:00:00 2001 From: Lilly Tempest <46890129+rainbowdashlabs@users.noreply.github.com> Date: Sun, 1 Sep 2024 16:37:23 +0200 Subject: [PATCH 04/21] Change group id --- build.gradle.kts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0c3ed14..b3b67bb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,28 +24,28 @@ gradlePlugin { plugins { register("bukkit") { - id = "net.minecrell.plugin-yml.bukkit" + id = "de.eldoria.plugin-yml.bukkit" displayName = "plugin-yml (Bukkit)" description = "Generate plugin.yml for Bukkit plugins based on the Gradle project" implementationClass = "net.minecrell.pluginyml.bukkit.BukkitPlugin" tags.set(listOf("bukkit")) } register("bungee") { - id = "net.minecrell.plugin-yml.bungee" + id = "de.eldoria.plugin-yml.bungee" displayName = "plugin-yml (BungeeCord)" description = "Generate bungee.yml for BungeeCord plugins based on the Gradle project" implementationClass = "net.minecrell.pluginyml.bungee.BungeePlugin" tags.set(listOf("bungee")) } register("nukkit") { - id = "net.minecrell.plugin-yml.nukkit" + id = "de.eldoria.plugin-yml.nukkit" displayName = "plugin-yml (Nukkit)" description = "Generate nukkit.yml for Nukkit plugins based on the Gradle project" implementationClass = "net.minecrell.pluginyml.nukkit.NukkitPlugin" tags.set(listOf("nukkit")) } register("paper") { - id = "net.minecrell.plugin-yml.paper" + id = "de.eldoria.plugin-yml.paper" displayName = "plugin-yml (Paper)" description = "Generate paper-plugin.yml for Paper plugins based on the Gradle project" implementationClass = "net.minecrell.pluginyml.paper.PaperPlugin" From 8a8cc46019d9fed4f322e4d954fe2db35175def2 Mon Sep 17 00:00:00 2001 From: Lilly <46890129+RainbowDashLabs@users.noreply.github.com> Date: Thu, 31 Oct 2024 11:28:18 +0100 Subject: [PATCH 05/21] Setup automatic publishing --- .github/workflows/publish.yml | 25 ++++++++++++++++++++++++ build.gradle.kts | 14 ++++++------- gradle.properties | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ef2a59e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ +name: Publish +on: + push: + branches: + - main + +jobs: + publish_gradle: + name: Publish to gradle portal + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2.3.5 + - uses: gradle/wrapper-validation-action@v1 + - name: Setup JDK + uses: actions/setup-java@v2.3.1 + with: + java-version: 8 + cache: 'gradle' + distribution: 'temurin' + - name: build + env: + GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} + GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} + run: ./gradlew publishPlugin diff --git a/build.gradle.kts b/build.gradle.kts index b3b67bb..ee793e8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,7 @@ plugins { `java-gradle-plugin` `kotlin-dsl` - id("com.gradle.plugin-publish") version "1.2.0" + id("com.gradle.plugin-publish") version "1.2.1" id("org.cadixdev.licenser") version "0.6.1" } @@ -19,8 +19,8 @@ dependencies { } gradlePlugin { - website.set(url) - vcsUrl.set(url) + website = url + vcsUrl = url plugins { register("bukkit") { @@ -28,28 +28,28 @@ gradlePlugin { displayName = "plugin-yml (Bukkit)" description = "Generate plugin.yml for Bukkit plugins based on the Gradle project" implementationClass = "net.minecrell.pluginyml.bukkit.BukkitPlugin" - tags.set(listOf("bukkit")) + tags = listOf("bukkit") } register("bungee") { id = "de.eldoria.plugin-yml.bungee" displayName = "plugin-yml (BungeeCord)" description = "Generate bungee.yml for BungeeCord plugins based on the Gradle project" implementationClass = "net.minecrell.pluginyml.bungee.BungeePlugin" - tags.set(listOf("bungee")) + tags = listOf("bungee") } register("nukkit") { id = "de.eldoria.plugin-yml.nukkit" displayName = "plugin-yml (Nukkit)" description = "Generate nukkit.yml for Nukkit plugins based on the Gradle project" implementationClass = "net.minecrell.pluginyml.nukkit.NukkitPlugin" - tags.set(listOf("nukkit")) + tags = listOf("nukkit") } register("paper") { id = "de.eldoria.plugin-yml.paper" displayName = "plugin-yml (Paper)" description = "Generate paper-plugin.yml for Paper plugins based on the Gradle project" implementationClass = "net.minecrell.pluginyml.paper.PaperPlugin" - tags.set(listOf("paper")) + tags = listOf("paper") } } } diff --git a/gradle.properties b/gradle.properties index 96adf05..eabea18 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ -group = net.minecrell +group = de.eldoria name = plugin-yml -version = 0.7.0-SNAPSHOT +version = 0.6.0 description = A Gradle plugin that generates plugin.yml for Bukkit/Paper/BungeeCord/Nukkit plugins based on the Gradle project -url = https://github.com/Minecrell/plugin-yml +url = https://github.com/eldoriarpg/plugin-yml diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d..5c40527 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 78abe175c94df8e7b3ea013a443e143733f3b343 Mon Sep 17 00:00:00 2001 From: Lilly <46890129+RainbowDashLabs@users.noreply.github.com> Date: Thu, 31 Oct 2024 11:48:54 +0100 Subject: [PATCH 06/21] [skip ci] Update license and setup renovate config --- .github/renovate.json | 6 +++++ HEADER.txt | 7 ++++++ LICENSE | 1 + build.gradle.kts | 11 ++++++++- .../pluginyml/GeneratePluginDescription.kt | 23 +++---------------- .../InvalidPluginDescriptionException.kt | 23 +++---------------- .../net/minecrell/pluginyml/PlatformPlugin.kt | 23 +++---------------- .../minecrell/pluginyml/PluginDescription.kt | 23 +++---------------- .../pluginyml/bukkit/BukkitPlugin.kt | 23 +++---------------- .../bukkit/BukkitPluginDescription.kt | 23 +++---------------- .../pluginyml/bungee/BungeePlugin.kt | 23 +++---------------- .../bungee/BungeePluginDescription.kt | 23 +++---------------- .../net/minecrell/pluginyml/libraries.kt | 23 +++---------------- .../pluginyml/nukkit/NukkitPlugin.kt | 23 +++---------------- .../nukkit/NukkitPluginDescription.kt | 23 +++---------------- .../minecrell/pluginyml/paper/PaperPlugin.kt | 23 +++---------------- .../pluginyml/paper/PaperPluginDescription.kt | 23 +++---------------- 17 files changed, 63 insertions(+), 261 deletions(-) create mode 100644 .github/renovate.json create mode 100644 HEADER.txt diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..ca2d9c1 --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "github>eldoriarpg/.github" + ] +} diff --git a/HEADER.txt b/HEADER.txt new file mode 100644 index 0000000..94fe4f2 --- /dev/null +++ b/HEADER.txt @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: MIT + * + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor + */ + diff --git a/LICENSE b/LICENSE index 0bcf40a..693c5a7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ The MIT License (MIT) Copyright (c) 2017 Minecrell +Copyright (c) 2024 EldoriaRPG and Contributor Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/build.gradle.kts b/build.gradle.kts index ee793e8..5e6fcff 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,7 +2,7 @@ plugins { `java-gradle-plugin` `kotlin-dsl` id("com.gradle.plugin-publish") version "1.2.1" - id("org.cadixdev.licenser") version "0.6.1" + id("com.diffplug.spotless") version "6.18.0" } val url: String by extra @@ -18,6 +18,15 @@ dependencies { implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2") } +spotless { + kotlin{ + licenseHeaderFile(rootProject.file("HEADER.txt")) + } + java { + target("**/*.java") + } +} + gradlePlugin { website = url vcsUrl = url diff --git a/src/main/kotlin/net/minecrell/pluginyml/GeneratePluginDescription.kt b/src/main/kotlin/net/minecrell/pluginyml/GeneratePluginDescription.kt index 719d5c0..f452519 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/GeneratePluginDescription.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/GeneratePluginDescription.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml diff --git a/src/main/kotlin/net/minecrell/pluginyml/InvalidPluginDescriptionException.kt b/src/main/kotlin/net/minecrell/pluginyml/InvalidPluginDescriptionException.kt index 9abe2d1..ac251fc 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/InvalidPluginDescriptionException.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/InvalidPluginDescriptionException.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml diff --git a/src/main/kotlin/net/minecrell/pluginyml/PlatformPlugin.kt b/src/main/kotlin/net/minecrell/pluginyml/PlatformPlugin.kt index fb4957b..0533d56 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/PlatformPlugin.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/PlatformPlugin.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml diff --git a/src/main/kotlin/net/minecrell/pluginyml/PluginDescription.kt b/src/main/kotlin/net/minecrell/pluginyml/PluginDescription.kt index 95d708c..d31addf 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/PluginDescription.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/PluginDescription.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml diff --git a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt index ece5705..e976a57 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml.bukkit diff --git a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPluginDescription.kt b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPluginDescription.kt index 1a3d561..e2ef9a8 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPluginDescription.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPluginDescription.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml.bukkit diff --git a/src/main/kotlin/net/minecrell/pluginyml/bungee/BungeePlugin.kt b/src/main/kotlin/net/minecrell/pluginyml/bungee/BungeePlugin.kt index 90b2256..0bbd3b0 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/bungee/BungeePlugin.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/bungee/BungeePlugin.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml.bungee diff --git a/src/main/kotlin/net/minecrell/pluginyml/bungee/BungeePluginDescription.kt b/src/main/kotlin/net/minecrell/pluginyml/bungee/BungeePluginDescription.kt index 283c6f4..3db65b8 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/bungee/BungeePluginDescription.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/bungee/BungeePluginDescription.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml.bungee diff --git a/src/main/kotlin/net/minecrell/pluginyml/libraries.kt b/src/main/kotlin/net/minecrell/pluginyml/libraries.kt index 97cc4e5..20c5889 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/libraries.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/libraries.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml diff --git a/src/main/kotlin/net/minecrell/pluginyml/nukkit/NukkitPlugin.kt b/src/main/kotlin/net/minecrell/pluginyml/nukkit/NukkitPlugin.kt index f235d30..5729f90 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/nukkit/NukkitPlugin.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/nukkit/NukkitPlugin.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml.nukkit diff --git a/src/main/kotlin/net/minecrell/pluginyml/nukkit/NukkitPluginDescription.kt b/src/main/kotlin/net/minecrell/pluginyml/nukkit/NukkitPluginDescription.kt index 8e10408..de2f06f 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/nukkit/NukkitPluginDescription.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/nukkit/NukkitPluginDescription.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml.nukkit diff --git a/src/main/kotlin/net/minecrell/pluginyml/paper/PaperPlugin.kt b/src/main/kotlin/net/minecrell/pluginyml/paper/PaperPlugin.kt index ec6840a..70ca6e9 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/paper/PaperPlugin.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/paper/PaperPlugin.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml.paper diff --git a/src/main/kotlin/net/minecrell/pluginyml/paper/PaperPluginDescription.kt b/src/main/kotlin/net/minecrell/pluginyml/paper/PaperPluginDescription.kt index ce4eaa7..d386d8d 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/paper/PaperPluginDescription.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/paper/PaperPluginDescription.kt @@ -1,25 +1,8 @@ /* - * The MIT License (MIT) + * SPDX-License-Identifier: MIT * - * Copyright (c) 2017 Minecrell - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * Copyright (c) 2017 Minecrell + * Copyright (c) 2024 EldoriaRPG and Contributor */ package net.minecrell.pluginyml.paper From ed1a2adb8f03af17a4dd57bb096df845fd173be7 Mon Sep 17 00:00:00 2001 From: Lilly Tempest <46890129+rainbowdashlabs@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:55:18 +0100 Subject: [PATCH 07/21] [skip ci] Move usage to the wiki --- README.md | 657 +----------------------------------------------------- 1 file changed, 2 insertions(+), 655 deletions(-) diff --git a/README.md b/README.md index 9480375..4ed29ca 100644 --- a/README.md +++ b/README.md @@ -5,660 +5,7 @@ the Gradle project. Various properties are set automatically (e.g. project name, additional properties can be added using a simple DSL. ## Usage -[plugin-yml] requires at least **Gradle 7.4**. Using the latest version of Gradle is recommended. -If you are using an older version of Gradle, try using an older version of plugin-yml as well. -plugin-yml `0.5.2` still supports Gradle 5.0+. -### Default values +Please consult the [wiki](https://github.com/eldoriarpg/plugin-yml/wiki) for up to date usage instructions -| Property | Value | -| ------------- | ------------- | -| Plugin name | Project name | -| Plugin version | Project version | -| Plugin description | Project description | -| Plugin URL (Bukkit only) | `url` project property | -| Plugin author | `author` project property | - -### Bukkit - -
-Groovy - -```groovy -plugins { - id 'net.minecrell.plugin-yml.bukkit' version '0.6.0' -} - -dependencies { - // Downloaded from Maven Central when the plugin is loaded - library 'com.google.code.gson:gson:2.10.1' // All platform plugins - bukkitLibrary 'com.google.code.gson:gson:2.10.1' // Bukkit only -} - -bukkit { - // Default values can be overridden if needed - // name = 'TestPlugin' - // version = '1.0' - // description = 'This is a test plugin' - // website = 'https://example.com' - // author = 'Notch' - - // Plugin main class (required) - main = 'com.example.testplugin.TestPlugin' - - // Mark plugin for supporting Folia - foliaSupported = true - - // API version (should be set for 1.13+) - apiVersion = '1.13' - - // Other possible properties from plugin.yml (optional) - load = 'STARTUP' // or 'POSTWORLD' - authors = ['Notch', 'Notch2'] - contributors = ['Notch3', 'Notch4'] - depend = ['WorldEdit'] - softDepend = ['Essentials'] - loadBefore = ['BrokenPlugin'] - prefix = 'TEST' - defaultPermission = 'OP' // 'TRUE', 'FALSE', 'OP' or 'NOT_OP' - provides = ['TestPluginOldName', 'TestPlug'] - - commands { - test { - description = 'This is a test command!' - aliases = ['t'] - permission = 'testplugin.test' - usage = 'Just run the command!' - // permissionMessage = 'You may not test this command!' - } - // ... - } - - permissions { - 'testplugin.*' { - children = ['testplugin.test'] // Defaults permissions to true - // You can also specify the values of the permissions - childrenMap = ['testplugin.test': false] - } - 'testplugin.test' { - description = 'Allows you to run the test command' - setDefault('OP') // 'TRUE', 'FALSE', 'OP' or 'NOT_OP' - } - } -} -``` -
- -
-kotlin-dsl - -```kotlin -plugins { - java // or `kotlin("jvm") version "..."` - id("net.minecrell.plugin-yml.bukkit") version "0.6.0" -} - -dependencies { - // Downloaded from Maven Central when the plugin is loaded - // library(kotlin("stdlib")) // When using kotlin - library("com.google.code.gson", "gson", "2.10.1") // All platform plugins - bukkitLibrary("com.google.code.gson", "gson", "2.10.1") // Bukkit only -} - -bukkit { - // Default values can be overridden if needed - // name = "TestPlugin" - // version = "1.0" - // description = "This is a test plugin" - // website = "https://example.com" - // author = "Notch" - - // Plugin main class (required) - main = "com.example.testplugin.TestPlugin" - - // Mark plugin for supporting Folia - foliaSupported = true - - // API version (should be set for 1.13+) - apiVersion = "1.13" - - // Other possible properties from plugin.yml (optional) - load = BukkitPluginDescription.PluginLoadOrder.STARTUP // or POSTWORLD - authors = listOf("Notch", "Notch2") - contributors = listOf("Notch3", "Notch4") - depend = listOf("WorldEdit") - softDepend = listOf("Essentials") - loadBefore = listOf("BrokenPlugin") - prefix = "TEST" - defaultPermission = BukkitPluginDescription.Permission.Default.OP // TRUE, FALSE, OP or NOT_OP - provides = listOf("TestPluginOldName", "TestPlug") - - commands { - register("test") { - description = "This is a test command!" - aliases = listOf("t") - permission = "testplugin.test" - usage = "Just run the command!" - // permissionMessage = "You may not test this command!" - } - // ... - } - - permissions { - register("testplugin.*") { - children = listOf("testplugin.test") // Defaults permissions to true - // You can also specify the values of the permissions - childrenMap = mapOf("testplugin.test" to true) - } - register("testplugin.test") { - description = "Allows you to run the test command" - default = BukkitPluginDescription.Permission.Default.OP // TRUE, FALSE, OP or NOT_OP - } - } -} -``` -
- -### Paper -
-Groovy - -```groovy -plugins { - id 'java' - id 'net.minecrell.plugin-yml.paper' version '0.6.0' -} - -repositories { - mavenCentral() - maven { url "https://papermc.io/repo/repository/maven-public/" } -} - -// NOTE: Paper does not support plugin libraries without additional setup! -// Please see "Plugin Libraries JSON" in the README for instructions. -dependencies { - // Downloaded from Maven Central when the plugin is loaded - library 'com.google.code.gson:gson:2.10.1' // All platform plugins - paperLibrary 'com.google.code.gson:gson:2.10.1' // Paper only - - // Make use of classes included by `bootstrapDependencies` and `serverDependencies` sections below - // compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.14' -} - -paper { - // Default values can be overridden if needed - // name = 'TestPlugin' - // version = '1.0' - // description = 'This is a test plugin' - // website = 'https://example.com' - // author = 'Notch' - - // Plugin main class (required) - main = 'com.example.testplugin.TestPlugin' - - // Plugin bootstrapper/loader (optional) - bootstrapper = 'com.example.testplugin.bootstrap.TestPluginBootstrap' - loader = 'com.example.testplugin.loader.TestPluginLoader' - hasOpenClassloader = false - - // Generate paper-libraries.json from `library` and `paperLibrary` in `dependencies` - generateLibrariesJson = true - - // Mark plugin for supporting Folia - foliaSupported = true - - // API version (needs to be 1.19 or higher) - apiVersion = '1.19' - - // Other possible properties from paper-plugin.yml (optional) - load = 'STARTUP' // or 'POSTWORLD' - authors = ['Notch', 'Notch2'] - contributors = ['Notch3', 'Notch4'] - prefix = 'TEST' - provides = ['TestPluginOldName', 'TestPlug'] - - // Bootstrap dependencies - Very rarely needed - bootstrapDependencies { - // Required dependency during bootstrap - 'WorldEdit' {} - - // During bootstrap, load BeforePlugin's bootstrap code before ours - 'BeforePlugin' { - load = 'BEFORE' - required = false - joinClasspath = false - } - // During bootstrap, load AfterPlugin's bootstrap code after ours - 'AfterPlugin' { - load = 'AFTER' - required = false - joinClasspath = false - } - } - - serverDependencies { - // During server run time, require LuckPerms, add it to the classpath, and load it before us - 'LuckPerms' { - load = 'BEFORE' - } - - // During server run time, require WorldEdit, add it to the classpath, and load it before us - 'WorldEdit' { - load = 'BEFORE' - } - - // Optional dependency, add it to classpath if it is available - 'ProtocolLib' { - required = false - } - - // During server run time, optionally depend on Essentials but do not add it to the classpath - 'Essentials' { - required = false - joinClasspath = false - } - } - - permissions { - 'testplugin.*' { - children = ['testplugin.test'] // Defaults permissions to true - // You can also specify the values of the permissions - childrenMap = ['testplugin.test': false] - } - 'testplugin.test' { - description = 'Allows you to run the test command' - setDefault('OP') // 'TRUE', 'FALSE', 'OP' or 'NOT_OP' - } - } -} -``` -
- -
-kotlin-dsl - -```kotlin -import net.minecrell.pluginyml.bukkit.BukkitPluginDescription -import net.minecrell.pluginyml.paper.PaperPluginDescription - -plugins { - java // or `kotlin("jvm") version "..."` - id("net.minecrell.plugin-yml.paper") version "0.6.0" -} - -repositories { - mavenCentral() - maven { url = uri("https://papermc.io/repo/repository/maven-public/") } -} - -// NOTE: Paper does not support plugin libraries without additional setup! -// Please see "Plugin Libraries JSON" in the README for instructions. -dependencies { - // Downloaded from Maven Central when the plugin is loaded - // library(kotlin("stdlib")) // When using kotlin - library("com.google.code.gson", "gson", "2.10.1") // All platform plugins - paperLibrary("com.google.code.gson", "gson", "2.10.1") // Paper only - - // Make use of classes included by `bootstrapDependencies` and `serverDependencies` sections below - // compileOnly("com.sk89q.worldedit", "worldedit-bukkit", "7.2.14") -} - -paper { - // Default values can be overridden if needed - // name = "TestPlugin" - // version = "1.0" - // description = "This is a test plugin" - // website = "https://example.com" - // author = "Notch" - - // Plugin main class (required) - main = "com.example.testplugin.TestPlugin" - - // Plugin bootstrapper/loader (optional) - bootstrapper = "com.example.testplugin.bootstrap.TestPluginBootstrap" - loader = "com.example.testplugin.loader.TestPluginLoader" - hasOpenClassloader = false - - // Generate paper-libraries.json from `library` and `paperLibrary` in `dependencies` - generateLibrariesJson = true - - // Mark plugin for supporting Folia - foliaSupported = true - - // API version (Needs to be 1.19 or higher) - apiVersion = "1.19" - - // Other possible properties from plugin.yml (optional) - load = BukkitPluginDescription.PluginLoadOrder.STARTUP // or POSTWORLD - authors = listOf("Notch", "Notch2") - - prefix = "TEST" - defaultPermission = BukkitPluginDescription.Permission.Default.OP // TRUE, FALSE, OP or NOT_OP - provides = listOf("TestPluginOldName", "TestPlug") - - bootstrapDependencies { - // Required dependency during bootstrap - register("WorldEdit") - - // During bootstrap, load BeforePlugin's bootstrap code before ours - register("BeforePlugin") { - required = false - load = PaperPluginDescription.RelativeLoadOrder.BEFORE - } - // During bootstrap, load AfterPlugin's bootstrap code after ours - register("AfterPlugin") { - required = false - load = PaperPluginDescription.RelativeLoadOrder.AFTER - } - } - - serverDependencies { - // During server run time, require LuckPerms, add it to the classpath, and load it before us - register("LuckPerms") { - load = PaperPluginDescription.RelativeLoadOrder.BEFORE - } - - // During server run time, require WorldEdit, add it to the classpath, and load it before us - register("WorldEdit") { - load = PaperPluginDescription.RelativeLoadOrder.BEFORE - } - - // Optional dependency, add it to classpath if it is available - register("ProtocolLib") { - required = false - } - - // During server run time, optionally depend on Essentials but do not add it to the classpath - register("Essentials") { - required = false - joinClasspath = false - } - } - - permissions { - register("testplugin.*") { - children = listOf("testplugin.test") // Defaults permissions to true - // You can also specify the values of the permissions - childrenMap = mapOf("testplugin.test" to true) - } - register("testplugin.test") { - description = "Allows you to run the test command" - default = BukkitPluginDescription.Permission.Default.OP // TRUE, FALSE, OP or NOT_OP - } - } -} -``` -
- -### BungeeCord - -
-Groovy - -```groovy -plugins { - id 'net.minecrell.plugin-yml.bungee' version '0.6.0' -} - -dependencies { - // Downloaded from Maven Central when the plugin is loaded - library 'com.google.code.gson:gson:2.10.1' // All platform plugins - bungeeLibrary 'com.google.code.gson:gson:2.10.1' // Bungee only -} - -bungee { - // Default values can be overridden if needed - // name = 'TestPlugin' - // version = '1.0' - // description = 'This is a test plugin' - - // Plugin main class (required) - main = 'com.example.testplugin.TestPlugin' - - // Other possible properties from bungee.yml - author = 'Notch' - depends = ['Yamler'] - softDepends = ['ServerListPlus'] -} -``` -
- -
-kotlin-dsl - -```kotlin -plugins { - java // or `kotlin("jvm") version "..."` - id("net.minecrell.plugin-yml.bungee") version "0.6.0" -} - -dependencies { - // Downloaded from Maven Central when the plugin is loaded - // library(kotlin("stdlib")) // When using kotlin - library("com.google.code.gson", "gson", "2.10.1") // All platform plugins - bungeeLibrary("com.google.code.gson", "gson", "2.10.1") // Bungee only -} - -bungee { - // Default values can be overridden if needed - // name = "TestPlugin" - // version = "1.0" - // description = "This is a test plugin" - - // Plugin main class (required) - main = "com.example.testplugin.TestPlugin" - - // Other possible properties from bungee.yml - author = "Notch" - depends = setOf("Yamler") - softDepends = setOf("ServerListPlus") -} -``` -
- -### Nukkit - -
-Groovy - -```groovy -plugins { - id 'net.minecrell.plugin-yml.nukkit' version '0.6.0' -} - -nukkit { - // Default values can be overridden if needed - // name = 'TestPlugin' - // version = '1.0' - // description = 'This is a test plugin' - // website = 'https://example.com' - // author = 'Notch' - - // Plugin main class and api (required) - main = 'com.example.testplugin.TestPlugin' - api = ['1.0.0'] - - // Other possible properties from nukkit.yml (optional) - load = 'STARTUP' // or 'POSTWORLD' - authors = ['Notch', 'Notch2'] - depend = ['PlotSquared'] - softDepend = ['LuckPerms'] - loadBefore = ['BrokenPlugin'] - prefix = 'TEST' - - commands { - test { - description = 'This is a test command!' - aliases = ['t'] - permission = 'testplugin.test' - usage = 'Just run the command!' - } - // ... - } - - permissions { - 'testplugin.*' { - description = 'Allows you to run all testplugin commands' - children { - 'testplugin.test' { - description = 'Allows you to run the test command' - setDefault('OP') // 'TRUE', 'FALSE', 'OP' or 'NOT_OP' - } - } - } - } -} -``` -
- -
-kotlin-dsl - -```kotlin -plugins { - java // or `kotlin("jvm") version "..."` - id("net.minecrell.plugin-yml.nukkit") version "0.6.0" -} - -nukkit { - // Default values can be overridden if needed - // name = "TestPlugin" - // version = "1.0" - // description = "This is a test plugin" - // website = "https://example.com" - // author = "Notch" - - // Plugin main class and api (required) - main = "com.example.testplugin.TestPlugin" - api = listOf("1.0.0") - - // Other possible properties from nukkit.yml (optional) - load = NukkitPluginDescription.PluginLoadOrder.STARTUP // or POSTWORLD - authors = listOf("Notch", "Notch2") - depend = listOf("PlotSquared") - softDepend = listOf("LuckPerms") - loadBefore = listOf("BrokenPlugin") - prefix = "TEST" - - commands { - register("test") { - description = "This is a test command!" - aliases = listOf("t") - permission = "testplugin.test" - usage = "Just run the command!" - } - // ... - } - - permissions { - register("testplugin.*") { - description = "Allows you to run all testplugin commands" - children { - register("testplugin.test") { - description = "Allows you to run the test command" - default = NukkitPluginDescription.Permission.Default.OP // TRUE, FALSE, OP or NOT_OP - } - } - } - } -} -``` -
- -## Plugin Libraries JSON -Paper and Nukkit do not support specifying libraries directly in the plugin description file. -plugin-yml still allows defining dependencies as `paperLibrary` and `nukkitLibrary` but these dependencies are not -exported by default. Additional runtime plugin code is needed to set them up and load them. To simplify this, plugin-yml -can export them in a `paper-libraries.json` / `nukkit-libraries.json` file with the following structure: - -```json -{ - "repositories": {"MavenRepo": "https://repo.maven.apache.org/maven2/"}, - "dependencies": ["com.google.code.gson:gson:2.10.1"] -} -``` - -This file is only generated after setting `generateLibrariesJson` to `true`, e.g.: - -```kotlin -paper { - // generate paper-libraries.json - generateLibrariesJson = true -} -``` - -The JSON file is included in the plugin JAR and can be parsed at runtime to load the additional libraries. - -### Paper -Define a custom `PluginLoader` inside your plugin code, for example: - -
-Example PluginLoader - -```kotlin -paper { - loader = "com.example.testplugin.PluginLibrariesLoader" - generateLibrariesJson = true -} -``` - -```java -import com.google.gson.Gson; -import io.papermc.paper.plugin.loader.PluginClasspathBuilder; -import io.papermc.paper.plugin.loader.PluginLoader; -import io.papermc.paper.plugin.loader.library.impl.MavenLibraryResolver; -import org.eclipse.aether.artifact.DefaultArtifact; -import org.eclipse.aether.graph.Dependency; -import org.eclipse.aether.repository.RemoteRepository; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.Map; -import java.util.stream.Stream; - -public class PluginLibrariesLoader implements PluginLoader { - @Override - public void classloader(@NotNull PluginClasspathBuilder classpathBuilder) { - MavenLibraryResolver resolver = new MavenLibraryResolver(); - PluginLibraries pluginLibraries = load(); - pluginLibraries.asDependencies().forEach(resolver::addDependency); - pluginLibraries.asRepositories().forEach(resolver::addRepository); - classpathBuilder.addLibrary(resolver); - } - - public PluginLibraries load() { - try (var in = getClass().getResourceAsStream("/paper-libraries.json")) { - return new Gson().fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), PluginLibraries.class); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private record PluginLibraries(Map repositories, List dependencies) { - public Stream asDependencies() { - return dependencies.stream() - .map(d -> new Dependency(new DefaultArtifact(d), null)); - } - - public Stream asRepositories() { - return repositories.entrySet().stream() - .map(e -> new RemoteRepository.Builder(e.getKey(), "default", e.getValue()).build()); - } - } -} -``` - -
- -### Nukkit -(No example code available yet) - -### Bukkit/Bungee -`generateLibrariesJson` is also supported on Bukkit/Bungee (to generate `bukkit-libraries.json`/`bungee-libraries.json`). -However, since these two allow specifying libraries directly inside the `plugin.yml` the option is generally not needed -there. - -[plugin-yml]: https://github.com/Minecrell/plugin-yml +[plugin-yml]: https://github.com/eldoriarpg/plugin-yml From 020afd93fc656c5a5d1bdee073bc1a322bd6f69d Mon Sep 17 00:00:00 2001 From: Lilly Tempest <46890129+rainbowdashlabs@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:52:14 +0100 Subject: [PATCH 08/21] Update workflows (#3) * [skip ci] Update build.yml * Update publish.yml --- .github/workflows/build.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4710916..f1a35ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 8, 11, 17 ] + java: [ 11, 17 ] fail-fast: true steps: - uses: actions/checkout@v2.3.5 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ef2a59e..4efed44 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,7 +15,7 @@ jobs: - name: Setup JDK uses: actions/setup-java@v2.3.1 with: - java-version: 8 + java-version: 11 cache: 'gradle' distribution: 'temurin' - name: build From 02e4343e6e9229303e57651ee97326c84adc6cc8 Mon Sep 17 00:00:00 2001 From: Lilly <46890129+RainbowDashLabs@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:57:15 +0100 Subject: [PATCH 09/21] Trigger deployment From f320ef88bbd92ffd8531d125399e3d6576052a2e Mon Sep 17 00:00:00 2001 From: Lilly Tempest <46890129+rainbowdashlabs@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:52:14 +0100 Subject: [PATCH 10/21] Update workflows (#3) * [skip ci] Update build.yml * Update publish.yml --- .github/workflows/build.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4710916..f1a35ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 8, 11, 17 ] + java: [ 11, 17 ] fail-fast: true steps: - uses: actions/checkout@v2.3.5 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ef2a59e..4efed44 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,7 +15,7 @@ jobs: - name: Setup JDK uses: actions/setup-java@v2.3.1 with: - java-version: 8 + java-version: 11 cache: 'gradle' distribution: 'temurin' - name: build From ea48a5bb37ed1723ee513b43c58b34a5cc217517 Mon Sep 17 00:00:00 2001 From: Lilly <46890129+RainbowDashLabs@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:56:00 +0100 Subject: [PATCH 11/21] Always run build --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f1a35ed..02b99eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,8 +3,6 @@ on: [ push, pull_request ] jobs: build: - # Only run on PRs if the source branch is on someone else's repo - if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} runs-on: ubuntu-latest strategy: matrix: From 0d036d7feee96524aafc501f108682d7610fdafa Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:56:16 +0100 Subject: [PATCH 12/21] chore(deps): update plugin com.diffplug.spotless to v6.25.0 (#5) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 5e6fcff..351c3ec 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,7 +2,7 @@ plugins { `java-gradle-plugin` `kotlin-dsl` id("com.gradle.plugin-publish") version "1.2.1" - id("com.diffplug.spotless") version "6.18.0" + id("com.diffplug.spotless") version "6.25.0" } val url: String by extra From b6bc9ebf8cf92bf871a1b85d367466ffc2276992 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:56:25 +0100 Subject: [PATCH 13/21] chore(deps): update actions/setup-java action to v2.5.1 (#4) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 02b99eb..1cc9d10 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v2.3.5 - uses: gradle/wrapper-validation-action@v1 - name: JDK ${{ matrix.java }} - uses: actions/setup-java@v2.3.1 + uses: actions/setup-java@v2.5.1 with: java-version: ${{ matrix.java }} cache: 'gradle' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4efed44..f88c724 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v2.3.5 - uses: gradle/wrapper-validation-action@v1 - name: Setup JDK - uses: actions/setup-java@v2.3.1 + uses: actions/setup-java@v2.5.1 with: java-version: 11 cache: 'gradle' From 80478e0abdaeaa1834de42321c685313fbcb2dd4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:02:58 +0100 Subject: [PATCH 14/21] fix(deps): update dependency com.fasterxml.jackson.dataformat:jackson-dataformat-yaml to v2.18.1 (#8) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 351c3ec..a486a97 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ dependencies { implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.2") { exclude(group = "org.jetbrains.kotlin") } - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2") + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.1") } spotless { From 73b0771d3357205ec970fc97c87cdd3f8ebc7d51 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:03:08 +0100 Subject: [PATCH 15/21] chore(deps): update plugin com.gradle.plugin-publish to v1.3.0 (#7) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index a486a97..78ca1e6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,7 @@ plugins { `java-gradle-plugin` `kotlin-dsl` - id("com.gradle.plugin-publish") version "1.2.1" + id("com.gradle.plugin-publish") version "1.3.0" id("com.diffplug.spotless") version "6.25.0" } From 14428b664972aa6efcdb075ab05d76972f47b4a8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:06:56 +0000 Subject: [PATCH 16/21] fix(deps): update dependency com.fasterxml.jackson.module:jackson-module-kotlin to v2.18.1 (#9) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 78ca1e6..4d7d2fa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,7 +12,7 @@ repositories { } dependencies { - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.2") { + implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.18.1") { exclude(group = "org.jetbrains.kotlin") } implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.18.1") From f5111f447cc9bce54399c7583a1990a8b6bb7f76 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:07:20 +0000 Subject: [PATCH 17/21] chore(deps): update actions/checkout action to v4 (#10) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1cc9d10..33023c6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: java: [ 11, 17 ] fail-fast: true steps: - - uses: actions/checkout@v2.3.5 + - uses: actions/checkout@v4.2.2 - uses: gradle/wrapper-validation-action@v1 - name: JDK ${{ matrix.java }} uses: actions/setup-java@v2.5.1 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f88c724..9b1470e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.5 + - uses: actions/checkout@v4.2.2 - uses: gradle/wrapper-validation-action@v1 - name: Setup JDK uses: actions/setup-java@v2.5.1 From 06e0e3ee669926837a0eb3b71164bd71e08fa9c4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:07:52 +0000 Subject: [PATCH 18/21] chore(deps): update actions/setup-java action to v4 --- .github/workflows/build.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 33023c6..2b4d0d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v4.2.2 - uses: gradle/wrapper-validation-action@v1 - name: JDK ${{ matrix.java }} - uses: actions/setup-java@v2.5.1 + uses: actions/setup-java@v4.5.0 with: java-version: ${{ matrix.java }} cache: 'gradle' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9b1470e..18db7d9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v4.2.2 - uses: gradle/wrapper-validation-action@v1 - name: Setup JDK - uses: actions/setup-java@v2.5.1 + uses: actions/setup-java@v4.5.0 with: java-version: 11 cache: 'gradle' From 2945e685237cf9f59b694673bd27561333708b13 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:11:50 +0000 Subject: [PATCH 19/21] chore(deps): update gradle/wrapper-validation-action action to v3 (#13) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2b4d0d0..4726628 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: fail-fast: true steps: - uses: actions/checkout@v4.2.2 - - uses: gradle/wrapper-validation-action@v1 + - uses: gradle/wrapper-validation-action@v3 - name: JDK ${{ matrix.java }} uses: actions/setup-java@v4.5.0 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 18db7d9..8422bfc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@v4.2.2 - - uses: gradle/wrapper-validation-action@v1 + - uses: gradle/wrapper-validation-action@v3 - name: Setup JDK uses: actions/setup-java@v4.5.0 with: From 3ce1c73a084e2418506e9ff49165dde4e3999690 Mon Sep 17 00:00:00 2001 From: Lilly Tempest <46890129+rainbowdashlabs@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:44:35 +0100 Subject: [PATCH 20/21] Feature/main and api validation (#1) --- .../pluginyml/bukkit/BukkitPlugin.kt | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt index e976a57..1d4710e 100644 --- a/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt +++ b/src/main/kotlin/net/minecrell/pluginyml/bukkit/BukkitPlugin.kt @@ -16,7 +16,15 @@ import org.gradle.api.artifacts.result.ResolvedComponentResult class BukkitPlugin : PlatformPlugin("Bukkit", "plugin.yml") { companion object { - @JvmStatic private val VALID_NAME = Regex("^[A-Za-z0-9 _.-]+$") + @JvmStatic + private val VALID_NAME = Regex("^[A-Za-z0-9 _.-]+$") + + @JvmStatic + private val VALID_API_VERSION = Regex("^1\\.[0-9]+$") + + @JvmStatic + private val INVALID_NAMESPACES = + listOf("net.minecraft.", "org.bukkit.", "io.papermc.", "com.destroystokoyo.paper.", "org.spigotmc") } override fun createExtension(project: Project) = BukkitPluginDescription(project) @@ -36,12 +44,25 @@ class BukkitPlugin : PlatformPlugin("Bukkit", "plugin.y override fun validate(description: BukkitPluginDescription) { val name = description.name ?: throw InvalidPluginDescriptionException("Plugin name is not set") if (!VALID_NAME.matches(name)) throw InvalidPluginDescriptionException("Invalid plugin name: should match $VALID_NAME") + if (description.apiVersion != null) { + val apiVersion = description.apiVersion!! + val splitVersion = apiVersion.split("\\.").map { v -> v.toInt() } + if (splitVersion.size == 2) { + if (!VALID_API_VERSION.matches(apiVersion)) throw InvalidPluginDescriptionException("Invalid api version: should match $VALID_API_VERSION") + if (apiVersion < "1.13") throw InvalidPluginDescriptionException("Invalid api version: should be at least 1.13") + } else if (splitVersion.size == 3) { + if (splitVersion[1] < 20) throw InvalidPluginDescriptionException("Invalid api version: Minor versions are not supported before 1.20.5") + if (splitVersion[1] == 20 && splitVersion[2] < 5) throw InvalidPluginDescriptionException("Invalid api version: Minor versions are not supported before 1.20.5") + } else { + throw InvalidPluginDescriptionException("Invalid api version: $VALID_API_VERSION") + } + } if (description.version.isNullOrEmpty()) throw InvalidPluginDescriptionException("Plugin version is not set") val main = description.main ?: throw InvalidPluginDescriptionException("Main class is not defined") if (main.isEmpty()) throw InvalidPluginDescriptionException("Main class cannot be empty") - if (main.startsWith("org.bukkit.")) throw InvalidPluginDescriptionException("Main may not be within the org.bukkit namespace") + validateNamespace(main, "Main") for (command in description.commands) { if (command.name.contains(':')) throw InvalidPluginDescriptionException("Command '${command.name}' cannot contain ':'") @@ -55,4 +76,11 @@ class BukkitPlugin : PlatformPlugin("Bukkit", "plugin.y } } + private fun validateNamespace(namespace: String, name: String) { + for (invalidNamespace in INVALID_NAMESPACES) { + if (namespace.startsWith(invalidNamespace)) { + throw InvalidPluginDescriptionException("$name may not be within the $invalidNamespace namespace") + } + } + } } From 2480d0c37d6c58f803a056c35a7a31282f0d0840 Mon Sep 17 00:00:00 2001 From: Lilly Tempest <46890129+rainbowdashlabs@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:45:48 +0100 Subject: [PATCH 21/21] Update gradle.properties --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index eabea18..a40dba7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group = de.eldoria name = plugin-yml -version = 0.6.0 +version = 0.7.0 description = A Gradle plugin that generates plugin.yml for Bukkit/Paper/BungeeCord/Nukkit plugins based on the Gradle project url = https://github.com/eldoriarpg/plugin-yml