1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-30 21:07:48 +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>
<groupId>Jobs</groupId>
<artifactId>jobs</artifactId>
<version>5.2.1.2</version>
<version>5.2.2.0</version>
<name>Jobs</name>
<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
*/
@SuppressWarnings("deprecation")
public void payAll() {
if (payments.isEmpty() || !plugin.isEnabled())
return;
@ -163,6 +163,9 @@ public class BufferedEconomy {
}
}
boolean hasMoney = false;
if (Jobs.getGCManager().UseServerAccount) {
try {
String serverAccountName = Jobs.getGCManager().ServerAccountName;
if (serverTaxesAccount == null)
@ -179,17 +182,21 @@ public class BufferedEconomy {
}
}
boolean hasMoney = false;
if (Jobs.getGCManager().UseServerAccount && economy.hasMoney(serverAccountName, totalAmount)) {
if (economy.hasMoney(serverAccountName, totalAmount)) {
hasMoney = true;
economy.withdrawPlayer(serverAccountName, totalAmount);
}
} catch (Throwable e) {
e.printStackTrace();
}
}
// Schedule all payments
int i = 0;
for (BufferedPayment payment : paymentCache.values()) {
i++;
try {
if (payment.getOfflinePlayer() == null)
continue;
@ -219,6 +226,9 @@ public class BufferedEconomy {
if (Version.getCurrent().isHigher(Version.v1_8_R3) && payment.getOfflinePlayer().isOnline()) {
Jobs.getBBManager().ShowJobProgression(Jobs.getPlayerManager().getJobsPlayer(payment.getOfflinePlayer().getUniqueId()));
}
} catch (Throwable e) {
e.printStackTrace();
}
}
// empty payment cache