diff --git a/src/main/java/de/epiceric/shopchest/utils/ShopUpdater.java b/src/main/java/de/epiceric/shopchest/utils/ShopUpdater.java index 0cd6222..a934fe8 100644 --- a/src/main/java/de/epiceric/shopchest/utils/ShopUpdater.java +++ b/src/main/java/de/epiceric/shopchest/utils/ShopUpdater.java @@ -3,14 +3,18 @@ package de.epiceric.shopchest.utils; import de.epiceric.shopchest.ShopChest; import de.epiceric.shopchest.event.ShopUpdateEvent; import org.bukkit.Bukkit; +import org.bukkit.scheduler.BukkitRunnable; public class ShopUpdater extends Thread { + private ShopChest plugin; + private boolean running; private long maxDelta; private long lastTime; public ShopUpdater(ShopChest plugin) { + this.plugin = plugin; setMaxDelta(plugin.getShopChestConfig().update_quality.getTime()); } @@ -37,7 +41,12 @@ public class ShopUpdater extends Thread { long timeElapsed = timeNow - lastTime; if (timeElapsed >= maxDelta) { - Bukkit.getPluginManager().callEvent(new ShopUpdateEvent()); + new BukkitRunnable() { + @Override + public void run() { + Bukkit.getPluginManager().callEvent(new ShopUpdateEvent()); + } + }.runTask(plugin); lastTime = timeNow; } }