After adding marker with Dynmap-api, MarkerSetImpl.loadPersistentData throws NullPointerException on restart
Roboroads opened this issue ยท 4 comments
I wrote a plugin that adds a marker to dynmap.
After restarting the server, i get the following error:
[15:13:28] [Server thread/ERROR]: Error occurred while enabling dynmap v3.1-beta-2-389 (Is it up to date?)
java.lang.NullPointerException: null
at org.dynmap.markers.impl.MarkerSetImpl.loadPersistentData(MarkerSetImpl.java:535) ~[?:?]
at org.dynmap.markers.impl.MarkerAPIImpl.loadMarkers(MarkerAPIImpl.java:717) ~[?:?]
at org.dynmap.markers.impl.MarkerAPIImpl.initializeMarkerAPI(MarkerAPIImpl.java:384) ~[?:?]
at org.dynmap.DynmapCore.initConfiguration(DynmapCore.java:410) ~[?:?]
at org.dynmap.bukkit.DynmapPlugin.onEnable(DynmapPlugin.java:905) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot-latest.jar:git-Spigot-9639cf7-52fd29c]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:351) ~[spigot-latest.jar:git-Spigot-9639cf7-52fd29c]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-latest.jar:git-Spigot-9639cf7-52fd29c]
at org.bukkit.craftbukkit.v1_16_R1.CraftServer.enablePlugin(CraftServer.java:493) ~[spigot-latest.jar:git-Spigot-9639cf7-52fd29c]
at org.bukkit.craftbukkit.v1_16_R1.CraftServer.enablePlugins(CraftServer.java:407) ~[spigot-latest.jar:git-Spigot-9639cf7-52fd29c]
at net.minecraft.server.v1_16_R1.MinecraftServer.loadWorld(MinecraftServer.java:438) ~[spigot-latest.jar:git-Spigot-9639cf7-52fd29c]
at net.minecraft.server.v1_16_R1.DedicatedServer.init(DedicatedServer.java:219) ~[spigot-latest.jar:git-Spigot-9639cf7-52fd29c]
at net.minecraft.server.v1_16_R1.MinecraftServer.v(MinecraftServer.java:810) ~[spigot-latest.jar:git-Spigot-9639cf7-52fd29c]
at net.minecraft.server.v1_16_R1.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot-latest.jar:git-Spigot-9639cf7-52fd29c]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
Code that adds the marker:
DynmapAPI dynmap = (DynmapAPI) plugin.getServer().getPluginManager().getPlugin("dynmap");
MarkerIcon heartMarkerIcon = dynmap.getMarkerAPI().getMarkerIcon("wod_heart");
if (heartMarkerIcon == null) {
InputStream stream;
File file;
Set<MarkerIcon> icons = new HashSet<>();
try {
file = new File("resources/base.png");
stream = new FileInputStream(file);
heartMarkerIcon = dynmap.getMarkerAPI().createMarkerIcon("wod_heart", "Heart", stream);
icons.add(heartMarkerIcon);
this.heartMarkerSet = dynmap.getMarkerAPI().createMarkerSet("Hearts", "Hearts", icons, true);
System.out.println("New marker icon created.");
} catch (final Exception e) {
e.printStackTrace();
throw new RuntimeException("Could not create markerset for DynMap");
}
} else {
this.heartMarkerSet = dynmap.getMarkerAPI().getMarkerSet("Hearts");
}
@Roboroads haha - thanks for the reply! Sorry this particular request didnt work out.
Closing off (as always - can paste the URL in a new ticket to reference)
Heya @Roboroads - are you still doing dynmap coding? Does this appear to be related to the linked 'file vanishes' issue?
There have been some markers work particularly around HTML special characters. If you want some direct support, find us on Discord #dev channel and get some faster answers
Related to #1936