From fa5cdb9211724fe4c4d3636c2a03c13faf9c3d6d Mon Sep 17 00:00:00 2001 From: fullwall Date: Sun, 1 Jan 2023 21:33:25 +0800 Subject: [PATCH] Cancel location lookup taskg --- main/src/main/java/net/citizensnpcs/Citizens.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/Citizens.java b/main/src/main/java/net/citizensnpcs/Citizens.java index 360f26e6f..0ac7c6845 100644 --- a/main/src/main/java/net/citizensnpcs/Citizens.java +++ b/main/src/main/java/net/citizensnpcs/Citizens.java @@ -403,7 +403,7 @@ public class Citizens extends JavaPlugin implements CitizensPlugin { } locationLookup = new LocationLookup(); - Bukkit.getScheduler().scheduleSyncRepeatingTask(this, locationLookup, 0, 5); + locationLookup.runTaskTimer(CitizensAPI.getPlugin(), 0, 5); speechFactory = new CitizensSpeechFactory(); npcRegistry = new CitizensNPCRegistry(saves, "citizens"); @@ -484,8 +484,9 @@ public class Citizens extends JavaPlugin implements CitizensPlugin { shops.loadFromDisk(); shops.load(); + locationLookup.cancel(); locationLookup = new LocationLookup(); - Bukkit.getScheduler().scheduleSyncRepeatingTask(this, locationLookup, 0, 5); + locationLookup.runTaskTimer(CitizensAPI.getPlugin(), 0, 5); Template.shutdown(); getServer().getPluginManager().callEvent(new CitizensReloadEvent());