Fix marker initialization

This commit is contained in:
Mike Primm 2020-06-07 20:41:22 -05:00
parent 7c0b515272
commit 3727fb622b
2 changed files with 17 additions and 5 deletions

View File

@ -508,6 +508,10 @@ public class DynmapCore implements DynmapCommonAPI {
mapManager = new MapManager(this, configuration);
mapManager.startRendering();
if (markerapi != null) {
MarkerAPIImpl.completeInitializeMarkerAPI(markerapi);
}
playerfacemgr = new PlayerFaces(this);
updateConfigHashcode(); /* Initialize/update config hashcode */

View File

@ -394,7 +394,15 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
if(api.markerdir.mkdirs() == false) { /* Create directory if needed */
Log.severe("Error creating markers directory - " + api.markerdir.getPath());
}
}
}
return api;
}
/**
* Singleton initializer complete (after rendder pool available
* @param core - core object
* @return API object
*/
public static void completeInitializeMarkerAPI(MarkerAPIImpl api) {
MapManager.scheduleDelayedJob(new Runnable() {
public void run() {
/* Now publish marker files to the tiles directory */
@ -404,13 +412,13 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener<DynmapWorld> {
/* Freshen files */
api.freshenMarkerFiles();
/* Add listener so we update marker files for other worlds as they become active */
core.events.addListener("worldactivated", api);
api.core.events.addListener("worldactivated", api);
api.scheduleWriteJob(); /* Start write job */
}
Log.info("Finish marker initialization");
}
}, 0);
return api;
}
public void scheduleWriteJob() {