1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00

Fix for issue with server account determination and usage causing

payments to be stopped
This commit is contained in:
Zrips 2023-11-16 17:56:53 +02:00
parent c5863bb121
commit ffd4309de7
2 changed files with 157 additions and 147 deletions

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>Jobs</groupId> <groupId>Jobs</groupId>
<artifactId>jobs</artifactId> <artifactId>jobs</artifactId>
<version>5.2.1.2</version> <version>5.2.2.0</version>
<name>Jobs</name> <name>Jobs</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>

View File

@ -87,7 +87,7 @@ public class BufferedEconomy {
/** /**
* Payout all players the amount they are going to be paid * Payout all players the amount they are going to be paid
*/ */
@SuppressWarnings("deprecation")
public void payAll() { public void payAll() {
if (payments.isEmpty() || !plugin.isEnabled()) if (payments.isEmpty() || !plugin.isEnabled())
return; return;
@ -163,6 +163,9 @@ public class BufferedEconomy {
} }
} }
boolean hasMoney = false;
if (Jobs.getGCManager().UseServerAccount) {
try {
String serverAccountName = Jobs.getGCManager().ServerAccountName; String serverAccountName = Jobs.getGCManager().ServerAccountName;
if (serverTaxesAccount == null) if (serverTaxesAccount == null)
@ -179,17 +182,21 @@ public class BufferedEconomy {
} }
} }
boolean hasMoney = false; if (economy.hasMoney(serverAccountName, totalAmount)) {
if (Jobs.getGCManager().UseServerAccount && economy.hasMoney(serverAccountName, totalAmount)) {
hasMoney = true; hasMoney = true;
economy.withdrawPlayer(serverAccountName, totalAmount); economy.withdrawPlayer(serverAccountName, totalAmount);
} }
} catch (Throwable e) {
e.printStackTrace();
}
}
// Schedule all payments // Schedule all payments
int i = 0; int i = 0;
for (BufferedPayment payment : paymentCache.values()) { for (BufferedPayment payment : paymentCache.values()) {
i++; i++;
try {
if (payment.getOfflinePlayer() == null) if (payment.getOfflinePlayer() == null)
continue; continue;
@ -219,6 +226,9 @@ public class BufferedEconomy {
if (Version.getCurrent().isHigher(Version.v1_8_R3) && payment.getOfflinePlayer().isOnline()) { if (Version.getCurrent().isHigher(Version.v1_8_R3) && payment.getOfflinePlayer().isOnline()) {
Jobs.getBBManager().ShowJobProgression(Jobs.getPlayerManager().getJobsPlayer(payment.getOfflinePlayer().getUniqueId())); Jobs.getBBManager().ShowJobProgression(Jobs.getPlayerManager().getJobsPlayer(payment.getOfflinePlayer().getUniqueId()));
} }
} catch (Throwable e) {
e.printStackTrace();
}
} }
// empty payment cache // empty payment cache