diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 9a7b52b73..3a3900dd4 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -452,7 +452,7 @@ public class PlayerListener implements Listener { if(ExperienceConfig.getInstance().isFishingExploitingPrevented()) { fishingManager.processExploiting(event.getHook().getLocation().toVector()); - + if (fishingManager.isExploitingFishing(event.getHook().getLocation().toVector())) { player.sendMessage(LocaleLoader.getString("Fishing.ScarcityTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange())); event.setExpToDrop(0); diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index 6dde1330d..d4d147325 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -51,6 +51,7 @@ public class FishingManager extends SkillManager { private long lastWarnedExhaust = 0L; private FishHook fishHookReference; private BoundingBox lastFishingBoundingBox; + private boolean sameTarget; private Item fishingCatch; private Location hookLocation; private int fishCaughtCounter = 1; @@ -127,12 +128,17 @@ public class FishingManager extends SkillManager { public void processExploiting(Vector centerOfCastVector) { BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector); - boolean sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox); + this.sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox); - if (sameTarget) + if (this.sameTarget) { fishCaughtCounter++; - else + } + else { fishCaughtCounter = 1; + } + + //If the new bounding box does not intersect with the old one, then update our bounding box reference + if (!this.sameTarget) lastFishingBoundingBox = newCastBoundingBox; if (fishCaughtCounter + 1 == ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit()) { getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange())); @@ -147,13 +153,7 @@ public class FishingManager extends SkillManager { return false; }*/ - BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector); - boolean sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox); - - //If the new bounding box does not intersect with the old one, then update our bounding box reference - if (!sameTarget) lastFishingBoundingBox = newCastBoundingBox; - - return sameTarget && fishCaughtCounter >= ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit(); + return this.sameTarget && fishCaughtCounter >= ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit(); } public static BoundingBox makeBoundingBox(Vector centerOfCastVector) {