NumberFormatException when checking the server version
RoboMWM opened this issue ยท 1 comments
Which module are you submitting this issue for?
Spigot
Describe the issue you are experiencing.
An error on startup:
[11:27:21] [Server thread/ERROR]: Error occurred while enabling Prison v0.10.0-SNAPSHOT (Is it up to date?)
java.lang.NumberFormatException: For input string: "12)"
at java.lang.NumberFormatException.forInputString(Unknown Source) ~[?:1.8.0_131]
at java.lang.Integer.parseInt(Unknown Source) ~[?:1.8.0_131]
at java.lang.Integer.parseInt(Unknown Source) ~[?:1.8.0_131]
at tech.mcprison.prison.spigot.SpigotPrison.initCompatibility(SpigotPrison.java:121) ~[?:?]
at tech.mcprison.prison.spigot.SpigotPrison.onEnable(SpigotPrison.java:77) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.12.jar:git-Paper-1122]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:316) [patched_1.12.jar:git-Paper-1122]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [patched_1.12.jar:git-Paper-1122]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:378) [patched_1.12.jar:git-Paper-1122]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:328) [patched_1.12.jar:git-Paper-1122]
at net.minecraft.server.v1_12_R1.MinecraftServer.t(MinecraftServer.java:441) [patched_1.12.jar:git-Paper-1122]
at net.minecraft.server.v1_12_R1.MinecraftServer.l(MinecraftServer.java:402) [patched_1.12.jar:git-Paper-1122]
at net.minecraft.server.v1_12_R1.MinecraftServer.a(MinecraftServer.java:340) [patched_1.12.jar:git-Paper-1122]
at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:283) [patched_1.12.jar:git-Paper-1122]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:615) [patched_1.12.jar:git-Paper-1122]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
[11:27:22] [Server thread/INFO]: [Prison] Disabling Prison v0.10.0-SNAPSHOT
[11:27:22] [Server thread/ERROR]: Error occurred while disabling Prison v0.10.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: null
at tech.mcprison.prison.spigot.SpigotPrison.onDisable(SpigotPrison.java:91) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:266) ~[patched_1.12.jar:git-Paper-1122]
at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:344) [patched_1.12.jar:git-Paper-1122]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:320) [patched_1.12.jar:git-Paper-1122]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [patched_1.12.jar:git-Paper-1122]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:378) [patched_1.12.jar:git-Paper-1122]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:328) [patched_1.12.jar:git-Paper-1122]
at net.minecraft.server.v1_12_R1.MinecraftServer.t(MinecraftServer.java:441) [patched_1.12.jar:git-Paper-1122]
at net.minecraft.server.v1_12_R1.MinecraftServer.l(MinecraftServer.java:402) [patched_1.12.jar:git-Paper-1122]
at net.minecraft.server.v1_12_R1.MinecraftServer.a(MinecraftServer.java:340) [patched_1.12.jar:git-Paper-1122]
at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:283) [patched_1.12.jar:git-Paper-1122]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:615) [patched_1.12.jar:git-Paper-1122]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
Describe the steps to reproduce the problem.
- Use b1e1d42 on server in place of old Prison 2 plugin
Anything else we need to know?
FYI, should use a try-catch here: https://github.com/MC-Prison/Prison/blob/master/prison-spigot/src/main/java/tech/mcprison/prison/spigot/SpigotPrison.java#L127
The code works only when the version contains 3 values (e.g. 1.11.2, 2 decimal delimiters). Otherwise you'll have to filter out that parenthesis.