jakobkmar / KSpigot

Extended Spigot and Bukkit API for Kotlin
https://jakobkmar.github.io/KSpigot
GNU General Public License v3.0
134 stars 35 forks source link

shadowJar and Paper/Spigot differences #54

Closed arslanarm closed 2 years ago

arslanarm commented 2 years ago

This is not the issue about a problem but the issue about readme and docs

ShadowJar

I was thinking about trying different libraries for making spigot plugins. By default I tried to use shadowJar to pack my plugin, but I was receiving weird error about paper runtime not having net.minecraft.commands.CommandSourceStack in the runtime classpath. My build script was fine. After fiddling with libraries and playing mind games with docs, I tried building plain java jar using jar task and exception disappeared. I personally don't know why building with shadowJar was causing this, maybe if someone tried to prove that shadowJar was the main cause of the exception, readme and docs can be appended with don't use shadowJar. To reproduce the exception just add shadowJar in the example buildscript in docs and try to use command

Paper/Spigot differences

I am a bit confused that KSpigot uses paper dependencies as main minecraft dependency. Is there any functionality in the KSpigot that depends on only Paper functionality? That would be awesome to see in docs

mooziii commented 2 years ago

You have to add the dependency to the libraries list of your plugin yml.

If you build a paperweight plugin with shadowJar it won't get remapped, thats why net.minecraft.commands.CommandSourceStack (which is mojang mapped) wasn't found on your reobfsucated server

l4zs commented 2 years ago

Since 1.18, we use paper instead of spigot, the name is kinda confusing I have to admit. Basically it shouldn't be called KSpigot anymore, because most of the functionality now depends on paper, therefore using KSpigot without paper is at your own risk. Here's a template if you happen to need one.

Using shadowJar was possible a while ago:

tasks {
    jar {
        enabled = false
    }
    build {
        dependsOn(reobfJar, shadowJar)
    }
    shadowJar {
    }
}

I didn't test if that still works. You can use the libraries in your plugin.yml tho, as already said.

arslanarm commented 2 years ago

Thanks for clarification!

I am so glad that you can specify now libraries in the plugin.yml. If this feature was released before 1.17, I guess I was ignorant and didn't look thorough enough :)