From 8b514d631c25538e9dd337ec8793f1c0d742abaf Mon Sep 17 00:00:00 2001 From: bm01 Date: Wed, 30 Jan 2013 23:29:36 +0100 Subject: [PATCH] Vanilla xp bonus should actually be in beginFishing() or at least be called by beginFishing() --- .../java/com/gmail/nossr50/listeners/PlayerListener.java | 3 +-- .../java/com/gmail/nossr50/skills/fishing/Fishing.java | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index a35005186..1c9392201 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -92,8 +92,7 @@ public class PlayerListener implements Listener { switch (event.getState()) { case CAUGHT_FISH: - Fishing.beginFishing(player, skillLevel, (Item) event.getCaught()); - event.setExpToDrop(event.getExpToDrop() * Fishing.getVanillaXpMultiplier(skillLevel)); + Fishing.beginFishing(player, skillLevel, event); break; case CAUGHT_ENTITY: diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java index 8645707fe..f6b12a562 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/Fishing.java @@ -9,6 +9,7 @@ import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.inventory.ItemStack; import com.gmail.nossr50.config.AdvancedConfig; @@ -104,9 +105,9 @@ public final class Fishing { * * @param player Player fishing * @param skillLevel Fishing level of the player - * @param caught Item reeled + * @param event Event to process */ - public static void beginFishing(Player player, int skillLevel, Item caught) { + public static void beginFishing(Player player, int skillLevel, PlayerFishEvent event) { int treasureXp = 0; FishingTreasure treasure = checkForTreasure(player, skillLevel); @@ -121,11 +122,13 @@ public final class Fishing { } // Drop the original catch at the feet of the player and set the treasure as the real catch + Item caught = (Item) event.getCaught(); Misc.dropItem(player.getEyeLocation(), caught.getItemStack()); caught.setItemStack(treasureDrop); } SkillTools.xpProcessing(player, Users.getProfile(player), SkillType.FISHING, Config.getInstance().getFishingBaseXP() + treasureXp); + event.setExpToDrop(event.getExpToDrop() * Fishing.getVanillaXpMultiplier(skillLevel)); } /**