mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-25 20:16:13 +01:00
Fix [#1587]
This commit is contained in:
parent
0ca90fbcb5
commit
af9c9b3b75
@ -1416,15 +1416,27 @@ public final class Jobs extends JavaPlugin {
|
|||||||
return 9 * level - 158;
|
return 9 * level - 158;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void perform(JobsPlayer jPlayer, ActionInfo info, BufferedPayment payment, Job job) {
|
public static void perform(JobsPlayer jPlayer, ActionInfo info, BufferedPayment payment, Job job, Block block, Entity ent, LivingEntity victim) {
|
||||||
double expPayment = payment.get(CurrencyType.EXP);
|
double expPayment = payment.get(CurrencyType.EXP);
|
||||||
|
|
||||||
|
JobsPrePaymentEvent jobsPrePaymentEvent = new JobsPrePaymentEvent(jPlayer.getPlayer(), noneJob, payment.get(CurrencyType.MONEY),
|
||||||
|
payment.get(CurrencyType.POINTS), block, ent, victim, info);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(jobsPrePaymentEvent);
|
||||||
|
// If event is canceled, don't do anything
|
||||||
|
if (jobsPrePaymentEvent.isCancelled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
payment.set(CurrencyType.MONEY, jobsPrePaymentEvent.getAmount());
|
||||||
|
payment.set(CurrencyType.POINTS, jobsPrePaymentEvent.getPoints());
|
||||||
|
|
||||||
JobsExpGainEvent jobsExpGainEvent = new JobsExpGainEvent(payment.getOfflinePlayer(), job, expPayment);
|
JobsExpGainEvent jobsExpGainEvent = new JobsExpGainEvent(payment.getOfflinePlayer(), job, expPayment);
|
||||||
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;
|
||||||
|
|
||||||
|
payment.set(CurrencyType.EXP, jobsExpGainEvent.getExp());
|
||||||
|
|
||||||
boolean limited = true;
|
boolean limited = true;
|
||||||
for (CurrencyType one : CurrencyType.values()) {
|
for (CurrencyType one : CurrencyType.values()) {
|
||||||
if (jPlayer.isUnderLimit(one, payment.get(one))) {
|
if (jPlayer.isUnderLimit(one, payment.get(one))) {
|
||||||
|
@ -447,7 +447,7 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
if (fp != null) {
|
if (fp != null) {
|
||||||
if (fp.getTime() > System.currentTimeMillis() && (fp.getInfo().getName().equalsIgnoreCase(bInfo.getName()) ||
|
if (fp.getTime() > System.currentTimeMillis() && (fp.getInfo().getName().equalsIgnoreCase(bInfo.getName()) ||
|
||||||
fp.getInfo().getNameWithSub().equalsIgnoreCase(bInfo.getNameWithSub()))) {
|
fp.getInfo().getNameWithSub().equalsIgnoreCase(bInfo.getNameWithSub()))) {
|
||||||
Jobs.perform(fp.getPlayer(), fp.getInfo(), fp.getPayment(), fp.getJob());
|
Jobs.perform(fp.getPlayer(), fp.getInfo(), fp.getPayment(), fp.getJob(), block, null, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Jobs.FASTPAYMENT.remove(player.getUniqueId());
|
Jobs.FASTPAYMENT.remove(player.getUniqueId());
|
||||||
@ -1974,7 +1974,7 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
|
|
||||||
if (fp.getTime() > System.currentTimeMillis() - 50L && (fp.getInfo().getName().equalsIgnoreCase(bInfo.getName()) ||
|
if (fp.getTime() > System.currentTimeMillis() - 50L && (fp.getInfo().getName().equalsIgnoreCase(bInfo.getName()) ||
|
||||||
fp.getInfo().getNameWithSub().equalsIgnoreCase(bInfo.getNameWithSub()))) {
|
fp.getInfo().getNameWithSub().equalsIgnoreCase(bInfo.getNameWithSub()))) {
|
||||||
Jobs.perform(fp.getPlayer(), fp.getInfo(), fp.getPayment(), fp.getJob());
|
Jobs.perform(fp.getPlayer(), fp.getInfo(), fp.getPayment(), fp.getJob(), block, null, null);
|
||||||
breakCache.put(CMILocation.toString(block.getLocation(), ":", true, true), uuid);
|
breakCache.put(CMILocation.toString(block.getLocation(), ":", true, true), uuid);
|
||||||
fp.setTime(System.currentTimeMillis() + 45);
|
fp.setTime(System.currentTimeMillis() + 45);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user