Question Unsupported API

Hexanilix

New member
Dec 24, 2022
6
0
1
Hey guys,
This is just a simple question (I think) about what "api-version: " version I use. I'm trying to make a 1.19.2 plugin and I'm new to all of this stuff and I can't resolve it. I searched everywhere and I can't find anything. What do I put here cuz I tried "1.19.2-R0.1-SNAPSHOT" and many other things but all gave the same result of: "org.bukkit.plugin.InvalidPluginException: Unsupported API version [...]"
 
Version Output
This server is running Paper version git-Paper-307 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT) (Git: 476ef25)
You are running the latest version
Last edited:

stefvanschie

Moderator
Staff member
Dec 17, 2021
97
3
16
8
The api-version can be either 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, or 1.19. So, only the first two numbers of the version number should be used.
 

Hexanilix

New member
Dec 24, 2022
6
0
1
Yea it just says "org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Plugin cannot be null" so no bueno. That's my problem NOTHING works
 

stefvanschie

Moderator
Staff member
Dec 17, 2021
97
3
16
8
A stacktrace looks something like this:
Code:
Exception in thread "main" java.lang.NullPointerException: Oops!
    at com.ericgoebelbecker.stacktraces.StackTrace.d(StackTrace.java:29)
    at com.ericgoebelbecker.stacktraces.StackTrace.c(StackTrace.java:24)
    at com.ericgoebelbecker.stacktraces.StackTrace.b(StackTrace.java:20)
    at com.ericgoebelbecker.stacktraces.StackTrace.a(StackTrace.java:16)
    at com.ericgoebelbecker.stacktraces.StackTrace.main(StackTrace.java:9)
(Example from https://www.sentinelone.com/blog/java-stack-trace-understanding/.)

You can also provide your entire log file if you want, it'll be in there.
 

Hexanilix

New member
Dec 24, 2022
6
0
1
Ah ok here:

[14:32:11 ERROR]: Could not load 'plugins/some-hex-code.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Plugin cannot be null
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:157) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:411) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:319) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:423) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:278) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1100) ~[paper-1.19.2.jar:git-Paper-307]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-307]
at java.lang.Thread.run(Thread.java:1589) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[commons-lang-2.6.jar:2.6]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.validate(CraftScheduler.java:548) ~[paper-1.19.2.jar:git-Paper-307]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:227) ~[paper-1.19.2.jar:git-Paper-307]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:212) ~[paper-1.19.2.jar:git-Paper-307]
at org.bukkit.craftbukkit.v1_19_R1.scheduler.CraftScheduler.scheduleSyncRepeatingTask(CraftScheduler.java:207) ~[paper-1.19.2.jar:git-Paper-307]
at hexy_mc_code.<init>(hexy_mc_code.java:34) ~[some-hex-code.jar:?]
at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67) ~[?:?]
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) ~[?:?]
at java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128) ~[?:?]
at jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:306) ~[?:?]
at java.lang.Class.newInstance(Class.java:684) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:83) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:153) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
... 7 more
 
Last edited:

Hexanilix

New member
Dec 24, 2022
6
0
1
Oh and this error is with the api-version in the .yml file set to this:

api-version: 1.19
 

Machine Maker

Paper Developer
Staff member
Dec 17, 2021
132
6
19
18
California
This is a bug with your plugin. Some field or variable somewhere called “plugin” is null when it can’t be. See the line in the stack trace hexy_mc_code.<init>(hexy_mc_code.java:34) ~[some-hex-code.jar:?]? That’s a line in your plugin causing the issue. I’m guessing you are trying to schedule a task when your plugin is loaded, but are using a field “called” plugin to hold your plugin instance which hasn’t been set yet.
 

Hexanilix

New member
Dec 24, 2022
6
0
1
Yea that's the culprit. Just found exactly that so thnx and now it works so have a nice one and Merry Christmas! (Also thnx mods for taking the time to help me :3)