1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-04 23:37:49 +01:00

Fixed issue when the pay is not work, #409

This commit is contained in:
montlikadani 2019-05-03 16:24:51 +02:00
parent 14253be043
commit 956acf8dd1
2 changed files with 8 additions and 7 deletions

Binary file not shown.

View File

@ -18,6 +18,8 @@
package com.gamingmesh.jobs.tasks; package com.gamingmesh.jobs.tasks;
import org.bukkit.Bukkit;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.economy.BufferedEconomy; import com.gamingmesh.jobs.economy.BufferedEconomy;
import com.gamingmesh.jobs.economy.BufferedPayment; import com.gamingmesh.jobs.economy.BufferedPayment;
@ -36,15 +38,14 @@ public class BufferedPaymentTask implements Runnable {
@Override @Override
public void run() { public void run() {
if (payment.getAmount() > 0) { if (payment.getAmount() > 0)
economy.depositPlayer(payment.getOfflinePlayer(), payment.getAmount()); Bukkit.getScheduler().runTask(Jobs.getInstance(), () -> economy.depositPlayer(payment.getOfflinePlayer(), payment.getAmount()));
} else { else {
if (!economy.withdrawPlayer(payment.getOfflinePlayer(), -payment.getAmount())) { if (!economy.withdrawPlayer(payment.getOfflinePlayer(), -payment.getAmount()))
bufferedEconomy.pay(payment); bufferedEconomy.pay(payment);
}
} }
if (payment.getPoints() != 0D) if (payment.getPoints() != 0D)
Jobs.getPlayerManager().getPointsData().addPoints(payment.getOfflinePlayer().getUniqueId(), payment.getPoints()); Jobs.getPlayerManager().getPointsData().addPoints(payment.getOfflinePlayer().getUniqueId(), payment.getPoints());
} }
} }