Giter VIP home page Giter VIP logo

Comments (6)

stephan-gh avatar stephan-gh commented on June 18, 2024
  1. You need to set the loader class in the paper { ... } block.

  2. I'm not sure. This part is a bit suspicious and looks like it would include classes from dependencies in your plugin JAR. Why do you need it? Same for the shadow plugin.

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

    If you want to use the library mechanism you shouldn't need any of this.

    It doesn't fully explain the problem though. kotlin-stdlib shouldn't actually end up in the runtimeClasspath, since library should be a compileOnly dependency. Maybe check ./gradlew :dependencies to get a list of dependencies and see if kotlin is actually on the runtimeClasspath and why.

from plugin-yml.

Agrigohar avatar Agrigohar commented on June 18, 2024

Thx for your quick response, the second issue has been solved. It seems like I copied the code snippet in at sometime and then just categorically overlooked it. Removing it solved the issue.

I've referenced my main class as loader in paper, the same class that is also named under paper.main. But at plugin startup the server doesn't find the kspigot class:
[EntrypointUtil] net/axay/kspigot/main/KSpigot java.lang.NoClassDefFoundError: net/axay/kspigot/main/KSpigot

And it is also not downloaded in the libraries folder in the server directory. But it referenced in the paper-libraries.json in the jar.

from plugin-yml.

stephan-gh avatar stephan-gh commented on June 18, 2024

You need to create a custom PluginLoader class, see https://github.com/Minecrell/plugin-yml#paper-1 ("Example PluginLoader").

In many cases it might be easier to declare a bukkit { ... } plugin instead. In that case you don't need a PluginLoader because Bukkit/Spigot plugins can declare libraries in plugin.yml. You can still use most of the Paper-specific API from a good old Bukkit/Spigot plugin.

Personally I would suggest using a Paper plugin only if you are sure that you can benefit from the new/extra functionality offered by those.

from plugin-yml.

Agrigohar avatar Agrigohar commented on June 18, 2024

Okay, yes replacing pluginYml for Paper with the bukkit version solved the issue for me. Thx a whole lot!
But how can I add my own libraries that are not on maven central? I've tried to shade them into the plugin using shadow. But everytime I use shadow the kotlin libraries and a whole lot more get included again.

from plugin-yml.

stephan-gh avatar stephan-gh commented on June 18, 2024

But how can I add my own libraries that are not on maven central?

In this case you could either use a custom PluginLoader for a Paper plugin, which would let you configure additional Maven repositories (see resolver::addRepository) in the example I linked.

I've tried to shade them into the plugin using shadow. But everytime I use shadow the kotlin libraries get included again.

Well, it's still not clear to me why you have kotlin on the runtimeClasspath used by shadow (see my first comment). It would be good to figure out why that happens, but you could also explicitly include only the dependencies you want (see https://imperceptiblethoughts.com/shadow/configuration/dependencies/#filtering-dependencies).

from plugin-yml.

Agrigohar avatar Agrigohar commented on June 18, 2024

Thanks a lot for your help! I was able to shade the required dependency into the plugin using:

tasks.shadowJar {
        dependencies {
            include(<My Dependency>)
        }
}

from plugin-yml.

Related Issues (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.