From 21673860c7b784189c8695a62308873e343f28c6 Mon Sep 17 00:00:00 2001 From: montlikadani Date: Fri, 23 Oct 2020 16:53:49 +0200 Subject: [PATCH] Fix different logic behavior for fast payment --- src/main/java/com/gamingmesh/jobs/PlayerManager.java | 3 +-- .../com/gamingmesh/jobs/container/ItemBonusCache.java | 8 ++++---- .../com/gamingmesh/jobs/container/QuestProgression.java | 8 +------- .../gamingmesh/jobs/listeners/JobsPaymentListener.java | 4 ++-- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index d9cb1c41..5a75c693 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -845,8 +845,7 @@ public class PlayerManager { ItemBonusCache c = cj.get(prog); if (c == null) { - c = new ItemBonusCache(); - c.setBoostMultiplier(getInventoryBoost(player, prog)); + c = new ItemBonusCache(getInventoryBoost(player, prog)); cj.put(prog, c); return c.getBoostMultiplier(); } diff --git a/src/main/java/com/gamingmesh/jobs/container/ItemBonusCache.java b/src/main/java/com/gamingmesh/jobs/container/ItemBonusCache.java index 0e28ea49..d1b8f815 100644 --- a/src/main/java/com/gamingmesh/jobs/container/ItemBonusCache.java +++ b/src/main/java/com/gamingmesh/jobs/container/ItemBonusCache.java @@ -4,11 +4,11 @@ public class ItemBonusCache { private BoostMultiplier bm = new BoostMultiplier(); + public ItemBonusCache(BoostMultiplier bm) { + this.bm = bm; + } + public BoostMultiplier getBoostMultiplier() { return bm; } - - public void setBoostMultiplier(BoostMultiplier bm) { - this.bm = bm; - } } diff --git a/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java b/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java index b5e99f8d..c269dee4 100644 --- a/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java +++ b/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java @@ -122,13 +122,7 @@ public class QuestProgression { jPlayer.setSaved(false); - if (!isCompleted()) - return; - - if (!jPlayer.isOnline()) - return; - - if (givenReward) + if (!isCompleted() || !jPlayer.isOnline() || givenReward) return; givenReward = true; diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index d65c17f7..e552cacf 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -384,8 +384,8 @@ public class JobsPaymentListener implements Listener { FastPayment fp = Jobs.FASTPAYMENT.get(player.getUniqueId()); if (fp != null) { - if (fp.getTime() > System.currentTimeMillis() && fp.getInfo().getName().equalsIgnoreCase(bInfo.getName()) || - fp.getInfo().getNameWithSub().equalsIgnoreCase(bInfo.getNameWithSub())) { + if (fp.getTime() > System.currentTimeMillis() && (fp.getInfo().getName().equalsIgnoreCase(bInfo.getName()) || + fp.getInfo().getNameWithSub().equalsIgnoreCase(bInfo.getNameWithSub()))) { Jobs.perform(fp.getPlayer(), fp.getInfo(), fp.getPayment(), fp.getJob()); return; }