mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 05:55:27 +01:00
Lets upgrade BufferedPayment
This commit is contained in:
parent
cb67b23c94
commit
fae5d65a88
@ -1023,7 +1023,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
Boost boost = getPlayerManager().getFinalBonus(jPlayer, noneJob);
|
Boost boost = getPlayerManager().getFinalBonus(jPlayer, noneJob);
|
||||||
|
|
||||||
JobsPrePaymentEvent JobsPrePaymentEvent = new JobsPrePaymentEvent(jPlayer.getPlayer(), noneJob, income,
|
JobsPrePaymentEvent JobsPrePaymentEvent = new JobsPrePaymentEvent(jPlayer.getPlayer(), noneJob, income,
|
||||||
pointAmount, block, ent, victim, info);
|
pointAmount, block, ent, victim, info);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(JobsPrePaymentEvent);
|
Bukkit.getServer().getPluginManager().callEvent(JobsPrePaymentEvent);
|
||||||
// If event is canceled, don't do anything
|
// If event is canceled, don't do anything
|
||||||
if (JobsPrePaymentEvent.isCancelled()) {
|
if (JobsPrePaymentEvent.isCancelled()) {
|
||||||
@ -1082,7 +1082,13 @@ public class Jobs extends JavaPlugin {
|
|||||||
if (pointAmount != 0D)
|
if (pointAmount != 0D)
|
||||||
jPlayer.setSaved(false);
|
jPlayer.setSaved(false);
|
||||||
|
|
||||||
economy.pay(jPlayer, income, pointAmount, 0.0);
|
HashMap<CurrencyType, Double> payments = new HashMap<CurrencyType, Double>();
|
||||||
|
if (income != 0D)
|
||||||
|
payments.put(CurrencyType.MONEY, income);
|
||||||
|
if (pointAmount != 0D)
|
||||||
|
payments.put(CurrencyType.POINTS, pointAmount);
|
||||||
|
|
||||||
|
economy.pay(jPlayer, payments);
|
||||||
|
|
||||||
if (GconfigManager.LoggingUse) {
|
if (GconfigManager.LoggingUse) {
|
||||||
HashMap<CurrencyType, Double> amounts = new HashMap<>();
|
HashMap<CurrencyType, Double> amounts = new HashMap<>();
|
||||||
@ -1226,10 +1232,18 @@ public class Jobs extends JavaPlugin {
|
|||||||
consoleMsg("&c[Jobs] Some issues with boss bar feature accured, try disabling it to avoid it.");
|
consoleMsg("&c[Jobs] Some issues with boss bar feature accured, try disabling it to avoid it.");
|
||||||
}
|
}
|
||||||
|
|
||||||
FastPayment.put(jPlayer.getPlayerUUID(), new FastPayment(jPlayer, info, new BufferedPayment(jPlayer.getPlayer(), income, pointAmount, expAmount), prog
|
HashMap<CurrencyType, Double> payments = new HashMap<CurrencyType, Double>();
|
||||||
|
if (income != 0D)
|
||||||
|
payments.put(CurrencyType.MONEY, income);
|
||||||
|
if (pointAmount != 0D)
|
||||||
|
payments.put(CurrencyType.POINTS, pointAmount);
|
||||||
|
if (expAmount != 0D)
|
||||||
|
payments.put(CurrencyType.EXP, expAmount);
|
||||||
|
|
||||||
|
FastPayment.put(jPlayer.getPlayerUUID(), new FastPayment(jPlayer, info, new BufferedPayment(jPlayer.getPlayer(), payments), prog
|
||||||
.getJob()));
|
.getJob()));
|
||||||
|
|
||||||
economy.pay(jPlayer, income, pointAmount, expAmount);
|
economy.pay(jPlayer, payments);
|
||||||
int oldLevel = prog.getLevel();
|
int oldLevel = prog.getLevel();
|
||||||
|
|
||||||
if (GconfigManager.LoggingUse) {
|
if (GconfigManager.LoggingUse) {
|
||||||
@ -1365,34 +1379,28 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
public static void perform(JobsPlayer jPlayer, ActionInfo info, BufferedPayment payment, Job job) {
|
public static void perform(JobsPlayer jPlayer, ActionInfo info, BufferedPayment payment, Job job) {
|
||||||
// JobsPayment event
|
// JobsPayment event
|
||||||
JobsExpGainEvent JobsExpGainEvent = new JobsExpGainEvent(payment.getOfflinePlayer(), job, payment.getExp());
|
JobsExpGainEvent JobsExpGainEvent = new JobsExpGainEvent(payment.getOfflinePlayer(), job, payment.get(CurrencyType.EXP));
|
||||||
Bukkit.getServer().getPluginManager().callEvent(JobsExpGainEvent);
|
Bukkit.getServer().getPluginManager().callEvent(JobsExpGainEvent);
|
||||||
// If event is canceled, don't do anything
|
// If event is canceled, don't do anything
|
||||||
if (JobsExpGainEvent.isCancelled())
|
if (JobsExpGainEvent.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!jPlayer.isUnderLimit(CurrencyType.MONEY, payment.getAmount()))
|
for (CurrencyType one : CurrencyType.values()) {
|
||||||
return;
|
if (!jPlayer.isUnderLimit(one, payment.get(one)))
|
||||||
if (!jPlayer.isUnderLimit(CurrencyType.EXP, payment.getExp()))
|
return;
|
||||||
return;
|
}
|
||||||
if (!jPlayer.isUnderLimit(CurrencyType.POINTS, payment.getPoints()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
economy.pay(jPlayer, payment.getAmount(), payment.getPoints(), payment.getExp());
|
economy.pay(jPlayer, payment.getPayment());
|
||||||
|
|
||||||
JobProgression prog = jPlayer.getJobProgression(job);
|
JobProgression prog = jPlayer.getJobProgression(job);
|
||||||
|
|
||||||
int oldLevel = prog.getLevel();
|
int oldLevel = prog.getLevel();
|
||||||
|
|
||||||
if (GconfigManager.LoggingUse) {
|
if (GconfigManager.LoggingUse) {
|
||||||
HashMap<CurrencyType, Double> amounts = new HashMap<>();
|
loging.recordToLog(jPlayer, info, payment.getPayment());
|
||||||
amounts.put(CurrencyType.MONEY, payment.getAmount());
|
|
||||||
amounts.put(CurrencyType.EXP, payment.getExp());
|
|
||||||
amounts.put(CurrencyType.POINTS, payment.getPoints());
|
|
||||||
loging.recordToLog(jPlayer, info, amounts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prog.addExperience(payment.getExp()))
|
if (prog.addExperience(payment.get(CurrencyType.EXP)))
|
||||||
getPlayerManager().performLevelUp(jPlayer, prog.getJob(), oldLevel);
|
getPlayerManager().performLevelUp(jPlayer, prog.getJob(), oldLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ package com.gamingmesh.jobs.economy;
|
|||||||
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.api.JobsPaymentEvent;
|
import com.gamingmesh.jobs.api.JobsPaymentEvent;
|
||||||
|
import com.gamingmesh.jobs.container.CurrencyType;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
|
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
|
||||||
import com.gamingmesh.jobs.tasks.BufferedPaymentTask;
|
import com.gamingmesh.jobs.tasks.BufferedPaymentTask;
|
||||||
@ -53,10 +54,20 @@ public class BufferedEconomy {
|
|||||||
* @param player - player to be paid
|
* @param player - player to be paid
|
||||||
* @param amount - amount to be paid
|
* @param amount - amount to be paid
|
||||||
*/
|
*/
|
||||||
public void pay(JobsPlayer player, double amount, double points, double exp) {
|
public void pay(JobsPlayer player, HashMap<CurrencyType, Double> payments) {
|
||||||
pay(new BufferedPayment(player.getPlayer(), amount, points, exp));
|
pay(new BufferedPayment(player.getPlayer(), payments));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Add payment to player's payment buffer
|
||||||
|
// * @param player - player to be paid
|
||||||
|
// * @param amount - amount to be paid
|
||||||
|
// */
|
||||||
|
// @Deprecated
|
||||||
|
// public void pay(JobsPlayer player, double amount, double points, double exp) {
|
||||||
|
// pay(new BufferedPayment(player.getPlayer(), amount, points, exp));
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add payment to player's payment buffer
|
* Add payment to player's payment buffer
|
||||||
* @param payment - payment to be paid
|
* @param payment - payment to be paid
|
||||||
@ -89,12 +100,12 @@ public class BufferedEconomy {
|
|||||||
// combine all payments using paymentCache
|
// combine all payments using paymentCache
|
||||||
while (!payments.isEmpty()) {
|
while (!payments.isEmpty()) {
|
||||||
BufferedPayment payment = payments.remove();
|
BufferedPayment payment = payments.remove();
|
||||||
TotalAmount += payment.getAmount();
|
TotalAmount += payment.get(CurrencyType.MONEY);
|
||||||
TotalPoints += payment.getPoints();
|
TotalPoints += payment.get(CurrencyType.POINTS);
|
||||||
|
|
||||||
if (Jobs.getGCManager().UseTaxes) {
|
if (Jobs.getGCManager().UseTaxes) {
|
||||||
TaxesAmount += payment.getAmount() * (Jobs.getGCManager().TaxesAmount / 100.0);
|
TaxesAmount += payment.get(CurrencyType.MONEY) * (Jobs.getGCManager().TaxesAmount / 100.0);
|
||||||
TaxesPoints += payment.getPoints() * (Jobs.getGCManager().TaxesAmount / 100.0);
|
TaxesPoints += payment.get(CurrencyType.POINTS) * (Jobs.getGCManager().TaxesAmount / 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payment.getOfflinePlayer() == null)
|
if (payment.getOfflinePlayer() == null)
|
||||||
@ -104,26 +115,26 @@ public class BufferedEconomy {
|
|||||||
if (paymentCache.containsKey(uuid)) {
|
if (paymentCache.containsKey(uuid)) {
|
||||||
BufferedPayment existing = paymentCache.get(uuid);
|
BufferedPayment existing = paymentCache.get(uuid);
|
||||||
|
|
||||||
double money = payment.getAmount();
|
double money = payment.get(CurrencyType.MONEY);
|
||||||
double points = payment.getPoints();
|
double points = payment.get(CurrencyType.POINTS);
|
||||||
double exp = payment.getExp();
|
double exp = payment.get(CurrencyType.EXP);
|
||||||
|
|
||||||
if (Jobs.getGCManager().TakeFromPlayersPayment && Jobs.getGCManager().UseTaxes) {
|
if (Jobs.getGCManager().TakeFromPlayersPayment && Jobs.getGCManager().UseTaxes) {
|
||||||
money = money - (money * (Jobs.getGCManager().TaxesAmount / 100.0));
|
money = money - (money * (Jobs.getGCManager().TaxesAmount / 100.0));
|
||||||
points = points - (points * (Jobs.getGCManager().TaxesAmount / 100.0));
|
points = points - (points * (Jobs.getGCManager().TaxesAmount / 100.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
existing.setAmount(existing.getAmount() + money);
|
existing.set(CurrencyType.MONEY, existing.get(CurrencyType.MONEY) + money);
|
||||||
existing.setPoints(existing.getPoints() + points);
|
existing.set(CurrencyType.POINTS, existing.get(CurrencyType.POINTS) + points);
|
||||||
existing.setExp(existing.getExp() + exp);
|
existing.set(CurrencyType.EXP, existing.get(CurrencyType.EXP) + exp);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
double money = payment.getAmount();
|
double money = payment.get(CurrencyType.MONEY);
|
||||||
double points = payment.getPoints();
|
double points = payment.get(CurrencyType.POINTS);
|
||||||
|
|
||||||
if (Jobs.getGCManager().TakeFromPlayersPayment && Jobs.getGCManager().UseTaxes) {
|
if (Jobs.getGCManager().TakeFromPlayersPayment && Jobs.getGCManager().UseTaxes) {
|
||||||
payment.setAmount(money - (money * (Jobs.getGCManager().TaxesAmount / 100.0)));
|
payment.set(CurrencyType.MONEY, money - (money * (Jobs.getGCManager().TaxesAmount / 100.0)));
|
||||||
payment.setPoints(points - (points * (Jobs.getGCManager().TaxesAmount / 100.0)));
|
payment.set(CurrencyType.POINTS, points - (points * (Jobs.getGCManager().TaxesAmount / 100.0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
paymentCache.put(uuid, payment);
|
paymentCache.put(uuid, payment);
|
||||||
@ -168,14 +179,14 @@ public class BufferedEconomy {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// JobsPayment event
|
// JobsPayment event
|
||||||
JobsPaymentEvent JobsPaymentEvent = new JobsPaymentEvent(payment.getOfflinePlayer(), payment.getAmount(), payment.getPoints());
|
JobsPaymentEvent JobsPaymentEvent = new JobsPaymentEvent(payment.getOfflinePlayer(), payment.get(CurrencyType.MONEY), payment.get(CurrencyType.POINTS));
|
||||||
Bukkit.getServer().getPluginManager().callEvent(JobsPaymentEvent);
|
Bukkit.getServer().getPluginManager().callEvent(JobsPaymentEvent);
|
||||||
// If event is canceled, dont do anything
|
// If event is canceled, dont do anything
|
||||||
if (JobsPaymentEvent.isCancelled())
|
if (JobsPaymentEvent.isCancelled())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
payment.setAmount(JobsPaymentEvent.getAmount());
|
payment.set(CurrencyType.MONEY, JobsPaymentEvent.getAmount());
|
||||||
payment.setPoints(JobsPaymentEvent.getPoints());
|
payment.set(CurrencyType.POINTS, JobsPaymentEvent.getPoints());
|
||||||
|
|
||||||
if (Jobs.getGCManager().UseServerAccount) {
|
if (Jobs.getGCManager().UseServerAccount) {
|
||||||
if (!hasMoney) {
|
if (!hasMoney) {
|
||||||
@ -220,25 +231,24 @@ public class BufferedEconomy {
|
|||||||
if (!ToggleBarHandling.getActionBarToggle().containsKey(playername))
|
if (!ToggleBarHandling.getActionBarToggle().containsKey(playername))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (payment.getAmount() == 0.0D && payment.getPoints() == 0.0D && payment.getExp() == 0.0D)
|
if (!payment.containsPayment())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Boolean show = ToggleBarHandling.getActionBarToggle().get(playername);
|
Boolean show = ToggleBarHandling.getActionBarToggle().get(playername);
|
||||||
Player abp = Bukkit.getPlayer(payment.getOfflinePlayer().getUniqueId());
|
Player abp = Bukkit.getPlayer(payment.getOfflinePlayer().getUniqueId());
|
||||||
if ((abp != null) && (show.booleanValue())) {
|
if ((abp != null) && (show.booleanValue())) {
|
||||||
String Message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main");
|
String Message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main");
|
||||||
if (payment.getAmount() != 0.0D) {
|
if (payment.get(CurrencyType.MONEY) != 0D) {
|
||||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", new Object[] { "[amount]", String.format(Jobs.getGCManager().getDecimalPlacesMoney(),
|
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", new Object[] { "[amount]", String.format(Jobs.getGCManager().getDecimalPlacesMoney(),
|
||||||
new Object[] { Double.valueOf(payment
|
new Object[] { Double.valueOf(payment.get(CurrencyType.MONEY)) }) });
|
||||||
.getAmount()) }) });
|
|
||||||
}
|
}
|
||||||
if (payment.getPoints() != 0.0D) {
|
if (payment.get(CurrencyType.POINTS) != 0D) {
|
||||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", new Object[] { "[points]", String.format(Jobs.getGCManager().getDecimalPlacesPoints(),
|
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", new Object[] { "[points]", String.format(Jobs.getGCManager().getDecimalPlacesPoints(),
|
||||||
new Object[] { Double.valueOf(payment.getPoints()) }) });
|
new Object[] { Double.valueOf(payment.get(CurrencyType.POINTS)) }) });
|
||||||
}
|
}
|
||||||
if (payment.getExp() != 0.0D) {
|
if (payment.get(CurrencyType.EXP) != 0D) {
|
||||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", new Object[] { "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(), new Object[] {
|
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", new Object[] { "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(), new Object[] {
|
||||||
Double.valueOf(payment.getExp()) }) });
|
Double.valueOf(payment.get(CurrencyType.EXP)) }) });
|
||||||
}
|
}
|
||||||
Jobs.getActionBar().send(abp, Message);
|
Jobs.getActionBar().send(abp, Message);
|
||||||
}
|
}
|
||||||
|
@ -18,46 +18,83 @@
|
|||||||
|
|
||||||
package com.gamingmesh.jobs.economy;
|
package com.gamingmesh.jobs.economy;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
|
||||||
|
import com.gamingmesh.jobs.container.CurrencyType;
|
||||||
|
|
||||||
public class BufferedPayment {
|
public class BufferedPayment {
|
||||||
private OfflinePlayer offlinePlayer;
|
private OfflinePlayer offlinePlayer;
|
||||||
private double amount = 0.0;
|
private HashMap<CurrencyType, Double> payments = new HashMap<CurrencyType, Double>();
|
||||||
private double points = 0.0;
|
|
||||||
private double exp = 0.0;
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public BufferedPayment(OfflinePlayer offlinePlayer, double amount, double points, double exp) {
|
public BufferedPayment(OfflinePlayer offlinePlayer, double amount, double points, double exp) {
|
||||||
this.offlinePlayer = offlinePlayer;
|
this.offlinePlayer = offlinePlayer;
|
||||||
this.amount = amount;
|
this.payments.put(CurrencyType.MONEY, amount);
|
||||||
this.points = points;
|
this.payments.put(CurrencyType.EXP, exp);
|
||||||
this.exp = exp;
|
this.payments.put(CurrencyType.POINTS, points);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BufferedPayment(OfflinePlayer offlinePlayer, HashMap<CurrencyType, Double> payments) {
|
||||||
|
this.offlinePlayer = offlinePlayer;
|
||||||
|
// This can contain only one value instead of all posible ones
|
||||||
|
this.payments.putAll(payments);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OfflinePlayer getOfflinePlayer() {
|
public OfflinePlayer getOfflinePlayer() {
|
||||||
return offlinePlayer;
|
return offlinePlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getAmount() {
|
@Deprecated
|
||||||
return amount;
|
public Double getAmount() {
|
||||||
|
return this.payments.get(CurrencyType.MONEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public double getPoints() {
|
public double getPoints() {
|
||||||
return points;
|
return this.payments.get(CurrencyType.POINTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public double getExp() {
|
public double getExp() {
|
||||||
return exp;
|
return this.payments.get(CurrencyType.EXP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void setAmount(double amount) {
|
public void setAmount(double amount) {
|
||||||
this.amount = amount;
|
this.payments.put(CurrencyType.MONEY, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void setPoints(double points) {
|
public void setPoints(double points) {
|
||||||
this.points = points;
|
this.payments.put(CurrencyType.POINTS, points);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void setExp(double exp) {
|
public void setExp(double exp) {
|
||||||
this.exp = exp;
|
this.payments.put(CurrencyType.EXP, exp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double get(CurrencyType type) {
|
||||||
|
Double amount = this.payments.get(type);
|
||||||
|
return amount == null ? 0 : amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double set(CurrencyType type, double amount) {
|
||||||
|
return this.payments.put(type, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean containsPayment() {
|
||||||
|
for (Entry<CurrencyType, Double> one : payments.entrySet()) {
|
||||||
|
if (one.getValue() != 0D)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<CurrencyType, Double> getPayment() {
|
||||||
|
return payments;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ package com.gamingmesh.jobs.tasks;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
|
import com.gamingmesh.jobs.container.CurrencyType;
|
||||||
import com.gamingmesh.jobs.economy.BufferedEconomy;
|
import com.gamingmesh.jobs.economy.BufferedEconomy;
|
||||||
import com.gamingmesh.jobs.economy.BufferedPayment;
|
import com.gamingmesh.jobs.economy.BufferedPayment;
|
||||||
import com.gamingmesh.jobs.economy.Economy;
|
import com.gamingmesh.jobs.economy.Economy;
|
||||||
@ -38,14 +39,14 @@ public class BufferedPaymentTask implements Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (payment.getAmount() > 0)
|
if (payment.get(CurrencyType.MONEY) > 0)
|
||||||
Bukkit.getScheduler().runTask(Jobs.getInstance(), () -> economy.depositPlayer(payment.getOfflinePlayer(), payment.getAmount()));
|
Bukkit.getScheduler().runTask(Jobs.getInstance(), () -> economy.depositPlayer(payment.getOfflinePlayer(), payment.get(CurrencyType.MONEY)));
|
||||||
else {
|
else {
|
||||||
if (!economy.withdrawPlayer(payment.getOfflinePlayer(), -payment.getAmount()))
|
if (!economy.withdrawPlayer(payment.getOfflinePlayer(), -payment.get(CurrencyType.MONEY)))
|
||||||
bufferedEconomy.pay(payment);
|
bufferedEconomy.pay(payment);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payment.getPoints() != 0D)
|
if (payment.get(CurrencyType.POINTS) != 0D)
|
||||||
Jobs.getPointsData().addPoints(payment.getOfflinePlayer().getUniqueId(), payment.getPoints());
|
Jobs.getPointsData().addPoints(payment.getOfflinePlayer().getUniqueId(), payment.get(CurrencyType.POINTS));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user