Skip to content

Commit

Permalink
Fix towns updates stopping after load. (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
LlmDl committed Jan 29, 2024
1 parent 0dc1b87 commit cdb18f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.dynmap</groupId>
<artifactId>Dynmap-Towny</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>

<build>
<defaultGoal>clean package</defaultGoal>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/dynmap/towny/DynmapTownyPlugin.java
Expand Up @@ -39,6 +39,7 @@ public class DynmapTownyPlugin extends JavaPlugin {
private static DynmapTownyPlugin plugin;
private final TaskScheduler scheduler;
private ScheduledTask task;
private UpdateTowns townUpdater;
private DynmapAPI dynmapAPI;
private MarkerAPI markerAPI;
private MarkerSet markerSet;
Expand Down Expand Up @@ -143,6 +144,9 @@ private void activate() {
/* Initialize the Styles from the config for use by the TownyUpdate task. */
AreaStyleHolder.initialize();

/* Create our UpdateTowns instance, used to actually draw the towns. */
townUpdater = new UpdateTowns();

/* Set up update job - based on period */
long per = Math.max(15, Settings.getUpdatePeriod()) * 20L;
task = scheduler.runAsyncRepeating(new TownyUpdate(), 40, per);
Expand Down Expand Up @@ -232,7 +236,7 @@ public Map<String, Marker> getMarkers() {
private class TownyUpdate implements Runnable {
public void run() {
if (TownyUniverse.getInstance().getDataSource() != null) {
scheduler.runAsync(new UpdateTowns());
scheduler.runAsync(townUpdater);

if (Settings.getPlayerVisibilityByTown())
TownyAPI.getInstance().getTowns().forEach(t -> updateTown(t));
Expand Down

0 comments on commit cdb18f1

Please sign in to comment.