Error on startup (NullPointerException)
BBaoVanC opened this issue ยท 2 comments
I'm not sure when this started happening, but now as the plugin is being enabled, I get this in the logs, and the plugin is then disabled.
[02:55:36 INFO]: [squaremap] Enabling squaremap v1.1.2
[02:55:37 ERROR]: Error occurred while enabling squaremap v1.1.2 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "java.util.Collection.iterator()" because "<parameter1>" is null
at java.util.concurrent.ConcurrentHashMap$KeySetView.addAll(Unknown Source) ~[?:?]
at xyz.jpenilla.squaremap.common.data.MapWorldInternal.deserializeDirtyChunks(MapWorldInternal.java:163) ~[squaremap-paper.jar:?]
at xyz.jpenilla.squaremap.common.data.MapWorldInternal.<init>(MapWorldInternal.java:119) ~[squaremap-paper.jar:?]
at xyz.jpenilla.squaremap.paper.data.PaperMapWorld.<init>(PaperMapWorld.java:21) ~[squaremap-paper.jar:?]
at xyz.jpenilla.squaremap.common.WorldManagerImpl.create(WorldManagerImpl.java:41) ~[squaremap-paper.jar:?]
at xyz.jpenilla.squaremap.common.WorldManagerImpl.lambda$getWorld$0(WorldManagerImpl.java:47) ~[squaremap-paper.jar:?]
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source) ~[?:?]
at xyz.jpenilla.squaremap.common.WorldManagerImpl.getWorld(WorldManagerImpl.java:45) ~[squaremap-paper.jar:?]
at xyz.jpenilla.squaremap.common.WorldManagerImpl.getWorldIfEnabled(WorldManagerImpl.java:34) ~[squaremap-paper.jar:?]
at xyz.jpenilla.squaremap.common.WorldManagerImpl.start(WorldManagerImpl.java:53) ~[squaremap-paper.jar:?]
at xyz.jpenilla.squaremap.paper.SquaremapPlugin.startCallback(SquaremapPlugin.java:103) ~[squaremap-paper.jar:?]
at xyz.jpenilla.squaremap.common.SquaremapCommon.start(SquaremapCommon.java:57) ~[squaremap-paper.jar:?]
at xyz.jpenilla.squaremap.common.SquaremapCommon.<init>(SquaremapCommon.java:50) ~[squaremap-paper.jar:?]
at xyz.jpenilla.squaremap.paper.SquaremapPlugin.onEnable(SquaremapPlugin.java:66) ~[squaremap-paper.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:501) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:559) ~[paper-1.18.2.jar:git-Paper-283]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:473) ~[paper-1.18.2.jar:git-Paper-283]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:664) ~[paper-1.18.2.jar:git-Paper-283]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:431) ~[paper-1.18.2.jar:git-Paper-283]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:316) ~[paper-1.18.2.jar:git-Paper-283]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.18.2.jar:git-Paper-283]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-283]
at java.lang.Thread.run(Unknown Source) ~[?:?]
[02:55:37 INFO]: [squaremap] Disabling squaremap v1.1.2
I'm not able to use the plugin at all anymore.
This implies you have a corrupted dirty_chunks.json
file for one of your worlds (located in data/[world_key]/
), deleting it should solve your issue.
I'll look at improving the error message and handling corrupted files more gracefully in a future version (i.e. print a warning about the corrupted data, and continue to load without it, instead of crashing), however there isn't much I can do beyond that as files corrupting is outside the scope of a squaremap issue.
If the corruption stems from when squaremap wrote the file, then it's a slightly different story, but we would need a stacktrace from that failed write in order to say anything further about whether it's an issue with squaremap or just some unfortunate file system issues.