diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index dbe522ad..03981a51 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -728,6 +728,7 @@ public class Jobs extends JavaPlugin { @Override public void onEnable() { running = true; + this.setEnabled(true); versionCheckManager = new VersionChecker(this); version = versionCheckManager.getVersion().getShortVersion(); @@ -840,6 +841,7 @@ public class Jobs extends JavaPlugin { String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &2Plugin has been disabled succesfully."); ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); console.sendMessage(message); + this.setEnabled(false); } /** diff --git a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java index feda7e3f..930a325f 100644 --- a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java +++ b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java @@ -77,6 +77,8 @@ public class BufferedEconomy { public void payAll() { if (payments.isEmpty()) return; + if (!plugin.isEnabled()) + return; synchronized (paymentCache) { @@ -181,14 +183,14 @@ public class BufferedEconomy { Jobs.getActionBar().send(payment.getOfflinePlayer().getPlayer(), ChatColor.RED + Jobs.getLanguage().getMessage("economy.error.nomoney")); continue; } - if (Jobs.getGCManager().isEconomyAsync()) + if (Jobs.getGCManager().isEconomyAsync()) { Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new BufferedPaymentTask(this, economy, payment), i); - else + } else Bukkit.getScheduler().runTaskLater(plugin, new BufferedPaymentTask(this, economy, payment), i); } else { - if (Jobs.getGCManager().isEconomyAsync()) + if (Jobs.getGCManager().isEconomyAsync()) { Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new BufferedPaymentTask(this, economy, payment), i); - else + } else Bukkit.getScheduler().runTaskLater(plugin, new BufferedPaymentTask(this, economy, payment), i); } try {