Solved Dynmap API, create an area, throws exception

Discussion in 'Spigot Plugin Development' started by plekz, Jan 7, 2020.

  1. Hi, I'm getting a nullpointerexception error from getMarkerAPI in the Dynmap api.

    Im using dynmap-2.5.jar.

    Error:
    Code (Java):
    [17:11:12] [Server thread/ERROR]: Error occurred while enabling NewCity v1.1.0 (Is it up to date?)
    java.lang.NullPointerException: null
            at org.dynmap.bukkit.DynmapPlugin.getMarkerAPI(DynmapPlugin.java:943) ~[?:?]
            at me.gubbestor.newcity.NewCity.onEnable(NewCity.java:61) ~[?:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot-1.14.4.jar:git-Spigot-9de398a-9c887d4]
    My code:
    Code (Java):
    public DynmapAPI dynmapAPI;
        public void onEnable() {
           
            dynmapAPI = (DynmapAPI) Bukkit.getServer().getPluginManager().getPlugin("dynmap");
    (Line 61) System.out.println("sasda    " + dynmapAPI.getMarkerAPI());
            }
     
  2. looks like dynmap is throwing an error. perhaps it hasnt had the chance to setup yet?
     
  3. How would I do it then? Is there a config to make dynmap load before my plugin?
     
  4. have you set your plugin to depend on dynmap using the depend array in your plugin.yml?
     
    • Winner Winner x 1
  5. Thanks, just did that. Now it works perfectly