mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
Moved same target to class variable
This commit is contained in:
parent
c4f890d00e
commit
e1e352656e
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user