From 0b8118566c8559dc09a1b7d370f12f9394944b35 Mon Sep 17 00:00:00 2001 From: Stormboomer Date: Sat, 1 Jun 2019 20:03:10 +0200 Subject: [PATCH] Added functionality for restarting the scheduled job that stores markers to markers.yml. This should fix problems with markers not being stored after a dynmap reload, as well as vanishing markers. --- DynmapCore/src/main/java/org/dynmap/DynmapCore.java | 2 +- .../main/java/org/dynmap/markers/impl/MarkerAPIImpl.java | 2 +- spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/DynmapCore/src/main/java/org/dynmap/DynmapCore.java b/DynmapCore/src/main/java/org/dynmap/DynmapCore.java index dceb8ea1..16bd294f 100644 --- a/DynmapCore/src/main/java/org/dynmap/DynmapCore.java +++ b/DynmapCore/src/main/java/org/dynmap/DynmapCore.java @@ -140,7 +140,7 @@ public class DynmapCore implements DynmapCommonAPI { public boolean is_reload = false; public static boolean ignore_chunk_loads = false; /* Flag keep us from processing our own chunk loads */ - private MarkerAPIImpl markerapi; + public MarkerAPIImpl markerapi; private File dataDirectory; private File tilesDirectory; diff --git a/DynmapCore/src/main/java/org/dynmap/markers/impl/MarkerAPIImpl.java b/DynmapCore/src/main/java/org/dynmap/markers/impl/MarkerAPIImpl.java index 3eb3692b..d22d7af3 100644 --- a/DynmapCore/src/main/java/org/dynmap/markers/impl/MarkerAPIImpl.java +++ b/DynmapCore/src/main/java/org/dynmap/markers/impl/MarkerAPIImpl.java @@ -407,7 +407,7 @@ public class MarkerAPIImpl implements MarkerAPI, Event.Listener { return api; } - private void scheduleWriteJob() { + public void scheduleWriteJob() { core.getServer().scheduleServerTask(new DoFileWrites(), 20); } diff --git a/spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java b/spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java index 23267bb3..e97356a1 100644 --- a/spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java +++ b/spigot/src/main/java/org/dynmap/bukkit/DynmapPlugin.java @@ -790,6 +790,12 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI { @Override public void onEnable() { + if(core != null){ + if(core.markerapi != null){ + getLogger().info("Starting Scheduled Write Job (markerAPI)."); + core.markerapi.scheduleWriteJob(); + } + } if (helper == null) { Log.info("Dynmap is disabled (unsupported platform)"); return;