|
@@ -56,9 +56,17 @@ public class FishingManager extends SkillManager {
|
|
|
private Item fishingCatch;
|
|
|
private Location hookLocation;
|
|
|
private int fishCaughtCounter = 1;
|
|
|
+ private final int masterAnglerMinWaitLowerBound;
|
|
|
+ private final int masterAnglerMaxWaitLowerBound;
|
|
|
|
|
|
public FishingManager(McMMOPlayer mcMMOPlayer) {
|
|
|
super(mcMMOPlayer, PrimarySkillType.FISHING);
|
|
|
+ //Ticks for minWait and maxWait never go below this value
|
|
|
+ int bonusCapMin = mcMMO.p.getAdvancedConfig().getFishingReductionMinWaitCap();
|
|
|
+ int bonusCapMax = mcMMO.p.getAdvancedConfig().getFishingReductionMaxWaitCap();
|
|
|
+
|
|
|
+ this.masterAnglerMinWaitLowerBound = Math.max(bonusCapMin, 0);
|
|
|
+ this.masterAnglerMaxWaitLowerBound = Math.max(bonusCapMax, masterAnglerMinWaitLowerBound + 40);
|
|
|
}
|
|
|
|
|
|
public boolean canShake(Entity target) {
|
|
@@ -254,13 +262,6 @@ public class FishingManager extends SkillManager {
|
|
|
* @param fishHook target fish hook
|
|
|
*/
|
|
|
public void processMasterAngler(@NotNull FishHook fishHook, int lureLevel) {
|
|
|
- McMMOPlayerMasterAnglerEvent event = new McMMOPlayerMasterAnglerEvent(mmoPlayer);
|
|
|
- mcMMO.p.getServer().getPluginManager().callEvent(event);
|
|
|
-
|
|
|
- if (event.isCancelled()) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
MasterAnglerCompatibilityLayer masterAnglerCompatibilityLayer = (MasterAnglerCompatibilityLayer) mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer();
|
|
|
|
|
|
if (masterAnglerCompatibilityLayer != null) {
|
|
@@ -280,12 +281,8 @@ public class FishingManager extends SkillManager {
|
|
|
int minWaitReduction = getMasterAnglerTickMinWaitReduction(masterAnglerRank, boatBonus);
|
|
|
int maxWaitReduction = getMasterAnglerTickMaxWaitReduction(masterAnglerRank, boatBonus, convertedLureBonus);
|
|
|
|
|
|
- //Ticks for minWait and maxWait never go below this value
|
|
|
- int bonusCapMin = mcMMO.p.getAdvancedConfig().getFishingReductionMinWaitCap();
|
|
|
- int bonusCapMax = mcMMO.p.getAdvancedConfig().getFishingReductionMaxWaitCap();
|
|
|
-
|
|
|
- int reducedMinWaitTime = getReducedTicks(minWaitTicks, minWaitReduction, bonusCapMin);
|
|
|
- int reducedMaxWaitTime = getReducedTicks(maxWaitTicks, maxWaitReduction, bonusCapMax);
|
|
|
+ int reducedMinWaitTime = getReducedTicks(minWaitTicks, minWaitReduction, masterAnglerMinWaitLowerBound);
|
|
|
+ int reducedMaxWaitTime = getReducedTicks(maxWaitTicks, maxWaitReduction, masterAnglerMaxWaitLowerBound);
|
|
|
|
|
|
boolean badValuesFix = false;
|
|
|
|
|
@@ -295,11 +292,23 @@ public class FishingManager extends SkillManager {
|
|
|
badValuesFix = true;
|
|
|
}
|
|
|
|
|
|
+ final McMMOPlayerMasterAnglerEvent event =
|
|
|
+ new McMMOPlayerMasterAnglerEvent(mmoPlayer, reducedMinWaitTime, reducedMaxWaitTime, this);
|
|
|
+ mcMMO.p.getServer().getPluginManager().callEvent(event);
|
|
|
+
|
|
|
+ if (event.isCancelled()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ reducedMaxWaitTime = event.getReducedMaxWaitTime();
|
|
|
+ reducedMinWaitTime = event.getReducedMinWaitTime();
|
|
|
+
|
|
|
if (mmoPlayer.isDebugMode()) {
|
|
|
mmoPlayer.getPlayer().sendMessage(ChatColor.GOLD + "Master Angler Debug");
|
|
|
|
|
|
if (badValuesFix) {
|
|
|
- mmoPlayer.getPlayer().sendMessage(ChatColor.RED + "Bad values were applied and corrected, check your configs, max wait should never be lower than min wait.");
|
|
|
+ mmoPlayer.getPlayer().sendMessage(ChatColor.RED + "Bad values were applied and corrected," +
|
|
|
+ " check your configs, minWaitLowerBound wait should never be lower than min wait.");
|
|
|
}
|
|
|
|
|
|
mmoPlayer.getPlayer().sendMessage("ALLOW STACK WITH LURE: " + masterAnglerCompatibilityLayer.getApplyLure(fishHook));
|
|
@@ -326,8 +335,8 @@ public class FishingManager extends SkillManager {
|
|
|
mmoPlayer.getPlayer().sendMessage("");
|
|
|
|
|
|
mmoPlayer.getPlayer().sendMessage(ChatColor.DARK_AQUA + "Caps / Limits (edit in advanced.yml)");
|
|
|
- mmoPlayer.getPlayer().sendMessage("Lowest possible max wait ticks " + bonusCapMax);
|
|
|
- mmoPlayer.getPlayer().sendMessage("Lowest possible min wait ticks " + bonusCapMin);
|
|
|
+ mmoPlayer.getPlayer().sendMessage("Lowest possible minWaitLowerBound wait ticks " + masterAnglerMinWaitLowerBound);
|
|
|
+ mmoPlayer.getPlayer().sendMessage("Lowest possible min wait ticks " + masterAnglerMaxWaitLowerBound);
|
|
|
}
|
|
|
|
|
|
masterAnglerCompatibilityLayer.setMaxWaitTime(fishHook, reducedMaxWaitTime);
|
|
@@ -724,4 +733,12 @@ public class FishingManager extends SkillManager {
|
|
|
private int getVanillaXpMultiplier() {
|
|
|
return getVanillaXPBoostModifier();
|
|
|
}
|
|
|
+
|
|
|
+ public int getMasterAnglerMinWaitLowerBound() {
|
|
|
+ return masterAnglerMinWaitLowerBound;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getMasterAnglerMaxWaitLowerBound() {
|
|
|
+ return masterAnglerMaxWaitLowerBound;
|
|
|
+ }
|
|
|
}
|