From c2e100b1e341c381f8ea81ace6a40a4b6f00d744 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Thu, 24 Oct 2013 21:17:10 +0200 Subject: [PATCH] Use hook location in Master Angler --- .../nossr50/commands/skills/FishingCommand.java | 5 ++++- .../nossr50/datatypes/player/McMMOPlayer.java | 14 ++++++++++++++ .../nossr50/skills/fishing/FishingManager.java | 3 ++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index 52ae368ff..a48a4536b 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -1,5 +1,6 @@ package com.gmail.nossr50.commands.skills; +import org.bukkit.Location; import org.bukkit.block.Biome; import org.bukkit.entity.EntityType; @@ -83,7 +84,9 @@ public class FishingCommand extends SkillCommand { // MASTER ANGLER if (canMasterAngler) { double rawBiteChance = 1.0 / (isStorming ? 300 : 500); - Biome biome = player.getLocation().getBlock().getBiome(); + Location location = (mcMMOPlayer.getHookLocation() != null) ? mcMMOPlayer.getHookLocation() : player.getLocation(); + + Biome biome = location.getBlock().getBiome(); if (biome == Biome.RIVER || biome == Biome.OCEAN) { rawBiteChance = rawBiteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier(); diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index 61106d797..61f997be2 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -86,6 +86,8 @@ public class McMMOPlayer { private int lastSalvageClick; private boolean godMode; + private Location hookLocation; + private final Map abilityMode = new HashMap(); private final Map abilityInformed = new HashMap(); @@ -499,6 +501,18 @@ public class McMMOPlayer { godMode = !godMode; } + /* + * Fishing: Master Angler + */ + + public Location getHookLocation() { + return hookLocation; + } + + public void setHookLocation(Location hookLocation) { + this.hookLocation = hookLocation; + } + /* * Skill notifications */ 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 18bb89b1d..c15922300 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -277,7 +277,8 @@ public class FishingManager extends SkillManager { public void masterAngler(Fish hook) { Player player = getPlayer(); - Biome biome = player.getLocation().getBlock().getBiome(); + mcMMOPlayer.setHookLocation(hook.getLocation()); + Biome biome = hook.getLocation().getBlock().getBiome(); double biteChance = hook.getBiteChance(); if (biome == Biome.RIVER || biome == Biome.OCEAN) {