Giter VIP home page Giter VIP logo

plugin-yml's Introduction

plugin-yml

plugin-yml is a simple Gradle plugin that generates the plugin.yml plugin description file for Bukkit plugins, paper-plugin.yml for Paper plugins, bungee.yml for Bungee plugins or nukkit.yml for Nukkit plugins based on the Gradle project. Various properties are set automatically (e.g. project name, version or description) and 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

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
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
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
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
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
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
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
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
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:

{
    "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.:

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
paper {
    loader = "com.example.testplugin.PluginLibrariesLoader"
    generateLibrariesJson = true
}
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<String, String> repositories, List<String> dependencies) {
        public Stream<Dependency> asDependencies() {
            return dependencies.stream()
                    .map(d -> new Dependency(new DefaultArtifact(d), null));
        }

        public Stream<RemoteRepository> 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's People

Contributors

56738 avatar booky10 avatar dawon avatar devsrsouza avatar jpenilla avatar lordofpipes avatar proximyst avatar rainbowdashlabs avatar stephan-gh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

plugin-yml's Issues

Support Shadow Plugin

When trying to use the plugin-yml in combination with com.github.johnrengelman.shadow (often used to shadow dependencies into the jar) library dependencies are shadowed into the jar.

Library dependencies should be compileOnly in this context.

Problems with dependencies still being included in class path

Hi, I am unsure if this is an issue with the project or if I am just using it wrong. But I've tried it for 5 sessions now without success and I am a bit frustrated so I thought I would just ask.

I have 2 main questions:

  1. I am using the libs.versions.toml for the dependency versions. I am using kSpigot to have better Kotlin support while developing my plugin. I have added it to my dependencies via library(), even tough I have configured paper to generate the libraries.json the dependency does not get downloaded and the plugin does not load because it is missing it. Is that because kSpigot changes something about how plugins are loaded or am I doing something wrong?

  2. I have added the kotlin stdlib as a library() dependency but my compiled jar still contains "kotlin" and "kotlinx" and other kotlin related stuff. What am I doing wrong there?

Thx for your help!

Snippet from build.gradle.kts:

dependencies {
    library(kotlin("stdlib"))
    library(libs.adventureApi)
    library(libs.adventureMiniMessage)

    library(libs.kSpigot)

    paperweight.paperDevBundle("1.20.1-R0.1-SNAPSHOT")
}

paper {
    website = "Website.de"
    version = pluginVersion
    description = "..."
    authors = listOf("Author1", "Author2")

    main = "<My main class>"

    foliaSupported = false
    apiVersion = "1.20"
    generateLibrariesJson = true
}
Entire build.gradle.kts
val repoUsername: String by project
val repoPassword: String by project
val langTestServerLocation: String by project

plugins {
  alias(libs.plugins.kotlinJvm)
  alias(libs.plugins.paperweight)
  alias(libs.plugins.pluginYmlPaper)
  alias(libs.plugins.shadow)
  `maven-publish`
}

val serverTestVersion = setOf("1.20")

val pluginVersion = "1.1.0"

repositories {
  mavenCentral()
  maven {
      url = uri("<my-repo>")
      credentials {
          username = repoUsername
          password = repoPassword
      }
  }
  maven("https://repo.cloudnetservice.eu/repository/releases/")
}

dependencies {
  library(kotlin("stdlib"))
  library(libs.adventureApi)
  library(libs.adventureMiniMessage)

  library(libs.kSpigot)

  paperweight.paperDevBundle("1.20.1-R0.1-SNAPSHOT")
}

paper {
  website = "Website.de"
  version = pluginVersion
  description = "..."
  authors = listOf("Author1", "Author2")

  main = "<My main class>"

  foliaSupported = false
  apiVersion = "1.20"
  generateLibrariesJson = true
}

publishing {
  repositories {
      maven {
          name = "repoPrivate"
          url = uri("<my-repo>>")
          credentials {
              username = repoUsername
              password = repoPassword
          }
      }
  }
  publications {
      create<MavenPublication>("maven") {
          groupId = "<class>"
          artifactId = "<name>"
          version = pluginVersion
          from(components["java"])
      }
  }
}

tasks.jar {
  val dependencies = configurations
      .runtimeClasspath
      .get()
      .map(::zipTree)
  from(dependencies)
  duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}



tasks {
  build {
      dependsOn(reobfJar)
  }
  compileJava {
      options.encoding = "UTF-8"
      options.release.set(17)
  }
  compileKotlin {
      kotlinOptions.jvmTarget = "17"
  }
}

tasks.register("deploy") {
  group = "deploy"
  description = "Deploys the plugin to the server"
  dependsOn(tasks.shadowJar)
  doLast {
      for (serverTestVersion in serverTestVersion) {
          val serverDirectory = File(langTestServerLocation, serverTestVersion)
          val pluginDirectory = File(serverDirectory, "plugins")
          val pluginFile = File(pluginDirectory, "${project.name}.jar")
          if (pluginFile.exists()) {
              pluginFile.delete()
          }
          pluginFile.createNewFile()
          pluginFile.writeBytes(tasks.shadowJar.get().archiveFile.get().asFile.readBytes())
      }
  }
}

Update Plugin

Could you please publish an update so I can use the fix for #20?

Execution failed for task ':generateBukkitPluginDescription'.

When trying to build my project, the following error occurs:

Execution failed for task ':generateBukkitPluginDescription'.
> Cannot fingerprint input property 'librariesConfiguration': value 'configuration ':bukkitLibrary'' cannot be serialized.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 11s
2 actionable tasks: 2 executed

my config:

bukkit {
    main = "rocks.clanattack.impl.entry.Boot"
    version = "0.0.0"
    apiVersion = "1.20"
    name = "ClanAttack Rocks (Core-API)"

    authors = listOf("CheeseTastisch")
    libraries = listOf(
        "com.fasterxml.jackson.core:jackson-databind:2.15.2",
        "com.fasterxml.jackson.module:jackson-module-kotlin:2.15.2",
        "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2",

        "org.jetbrains.kotlin:kotlin-reflect:1.7.22",
        "org.reflections:reflections:0.9.12"
    )
}

paper-plugin.yml | How to do?

Hey,
How am I'm supposed to create a bootloader for a plugin which will automatically load the dependencies from the 'paper-libraries.json'(? not sure if this name is correct, it is very poorly documented).
When using the 'paperLibrary(depencency)' keyword it will not load the dependency in the plugin.

No signature of method: build_cs1dxgpbzjvnqu203tc6dv6un.bukkit() is applicable for argument types:

A problem occurred evaluating root project 'Hordes-1.8'.
> No signature of method: build_cs1dxgpbzjvnqu203tc6dv6un.bukkit() is applicable for argument types: (build_cs1dxgpbzjvnqu203tc6dv6un$_run_closure6) values: [build_cs1dxgpbzjvnqu203tc6dv6un$_run_closure6@4ad59117]
  Possible solutions: wait(), wait(long), mkdir(java.lang.Object), uri(java.lang.Object), split(groovy.lang.Closure)

When I add depend = asList('WorldGuard', 'PlaceholderAPI') to the bukkit task. been stuck on this for a bit. gradle version: 7.5.1

PaperMC api-version lower than 1.19

Hello,
I don't quite understand why the api-version field has to be set to at least 1.19.
As far as I know this property was already present in 1.16 versions and I want to indicate that my plugin is compatible with any version since 1.16.
Am I missing something that explains this?
Cheers.

"library" not adding dependencies to pom.xml for Maven publication

So whenever I add something to my plugin as a library, it works fine. However, there's one problem. It won't add them to the pom.xml used for publishing.

To reproduce:

  • Add something as a library
  • Run the generatePomFileForMavenPublication task

If you're interested, my build.gradle file is here: https://github.com/plexusorg/Plex/blob/master/build.gradle

You'll see that it won't add it to the pom.xml. Any idea if we can get a fix for this?

PS: this plugin doesn't work on Gradle 7.4+

Libraries file includes every single repository

When you enable generation of the libraries file, the file includes all repositories that you have set in the entire gradle project, this isn't a big issue but it causes server to keep looking around repositories.

Ways this can be fixed

  • Automatically detect the repositories required
  • Allow us to override the repositories section that will be put in the libraries file

generateLibrariesJson doesn't respect dependency classifier/extension

Exported dependency coords do not include classifiers and extensions. This leads to some bugs, e.g. server trying to download jar artifact for pom dependency (with PluginLoader implementation presented in README)

My personal workaround atm is exporting artifacts instead of dependencies, but you may not like it because of increased JSON file size.

Can't import plugin

When importing the plugin using id 'net.minecrell.plugin-yml.paper' version '0.6.0-SNAPSHOT' (groovy) I get this error:

org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'net.minecrell.plugin-yml.paper', version: '0.6.0-SNAPSHOT'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'net.minecrell.plugin-yml.paper:net.minecrell.plugin-yml.paper.gradle.plugin:0.6.0-SNAPSHOT')
  Searched in the following repositories:
    Gradle Central Plugin Repository
    maven(https://papermc.io/repo/repository/maven-public/)

Commands (and very likely permissions) are broken on Gradle 4.10

When I try to create a new command, then Gradle throws an exception and mentions something about "Command with name 'creategame' not found.". Here's the stacktrace: https://paste.wut.ee/avecocenoz.cs
I guess that something changed in Gradle API? 🤔
It works in 4.8 perfectly. I tried both 0.2.1 and 0.3.0 plugin versions.

I have this in my build.gradle.kts:

bukkit {
    name = "x"
    description = "y"
    authors = listOf("mikroskeem")
    main = "z"

    commands {
        "creategame" {
            description = "Creates a new game"
        }
    }
}

Current workaround is to use this:

bukkit {
    // ...
    commands.create("creategame") {
        description = "Creates a new game"
    }
}

Add compatibility with gradle configuration cache

When trying to use this plugin with configuration cache we have these issues, would be glad if you'll be able to add this compatibility

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':script-host:generateBukkitPluginDescription'.
> Cannot fingerprint input property 'librariesConfiguration': value 'configuration ':script-host:bukkitLibrary'' cannot be serialized.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Configuration cache problems found in this build.

3 problems were found storing the configuration cache, 2 of which seem unique.
- Task `:script-host:generateBukkitPluginDescription` of type `net.minecrell.pluginyml.GeneratePluginDescription`: cannot serialize object of type 'org.gradle.api.internal.artifacts.configurations.DefaultConfiguration', a subtype of 'org.gradle.api.artifacts.Configuration', as these are not supported with the configuration cache.
  See https://docs.gradle.org/8.0.2/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:script-host:generateBukkitPluginDescription` of type `net.minecrell.pluginyml.GeneratePluginDescription`: cannot serialize object of type 'org.gradle.api.internal.project.DefaultProject', a subtype of 'org.gradle.api.Project', as these are not supported with the configuration cache.
  See https://docs.gradle.org/8.0.2/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
  
  
See the complete report at [generated file](https://github.com/Minecrell/plugin-yml/files/11211022/configuration-cache-report.zip)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
Configuration cache entry discarded with 3 problems.

Support 1.20

apiVersion = "1.20" is resulting in the plugin.yml having: api-version: 1.20, which yml interprets as 1.2.

Update plugin

The version found at plugins.gradle.org is still 0.4.0. It does not contain support for libraries.
I would love to make use of this feature without having to add the plugin manually to the classpath.

Task generateBukkitPluginDescription fails

When I try to build my project I receive the following error:

Execution failed for task 'Project:generateBukkitPluginDescription'.
> 'com.fasterxml.jackson.core.io.ContentReference com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createContentReference(java.lang.Object)'
My build.gradle.kts contents
bukkit {
    main = "main"
    version = pluginVersion
}

paper {
    website = "content"
    version = pluginVersion
    description = "content"
    authors = listOf("content")
    main = "main"
    foliaSupported = false
    apiVersion = "1.20"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.