1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 15:03:36 +01:00

Try to prevent payments when plugin is already disabled

This commit is contained in:
Zrips 2017-06-27 16:38:16 +03:00
parent 2cb203c38d
commit 81b746ace4
2 changed files with 8 additions and 4 deletions

View File

@ -728,6 +728,7 @@ public class Jobs extends JavaPlugin {
@Override @Override
public void onEnable() { public void onEnable() {
running = true; running = true;
this.setEnabled(true);
versionCheckManager = new VersionChecker(this); versionCheckManager = new VersionChecker(this);
version = versionCheckManager.getVersion().getShortVersion(); version = versionCheckManager.getVersion().getShortVersion();
@ -840,6 +841,7 @@ public class Jobs extends JavaPlugin {
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &2Plugin has been disabled succesfully."); String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &2Plugin has been disabled succesfully.");
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
console.sendMessage(message); console.sendMessage(message);
this.setEnabled(false);
} }
/** /**

View File

@ -77,6 +77,8 @@ public class BufferedEconomy {
public void payAll() { public void payAll() {
if (payments.isEmpty()) if (payments.isEmpty())
return; return;
if (!plugin.isEnabled())
return;
synchronized (paymentCache) { synchronized (paymentCache) {
@ -181,14 +183,14 @@ public class BufferedEconomy {
Jobs.getActionBar().send(payment.getOfflinePlayer().getPlayer(), ChatColor.RED + Jobs.getLanguage().getMessage("economy.error.nomoney")); Jobs.getActionBar().send(payment.getOfflinePlayer().getPlayer(), ChatColor.RED + Jobs.getLanguage().getMessage("economy.error.nomoney"));
continue; continue;
} }
if (Jobs.getGCManager().isEconomyAsync()) if (Jobs.getGCManager().isEconomyAsync()) {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new BufferedPaymentTask(this, economy, payment), i); Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new BufferedPaymentTask(this, economy, payment), i);
else } else
Bukkit.getScheduler().runTaskLater(plugin, new BufferedPaymentTask(this, economy, payment), i); Bukkit.getScheduler().runTaskLater(plugin, new BufferedPaymentTask(this, economy, payment), i);
} else { } else {
if (Jobs.getGCManager().isEconomyAsync()) if (Jobs.getGCManager().isEconomyAsync()) {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new BufferedPaymentTask(this, economy, payment), i); Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new BufferedPaymentTask(this, economy, payment), i);
else } else
Bukkit.getScheduler().runTaskLater(plugin, new BufferedPaymentTask(this, economy, payment), i); Bukkit.getScheduler().runTaskLater(plugin, new BufferedPaymentTask(this, economy, payment), i);
} }
try { try {