From 017e32c30a6f283bce89f463450159456b0602d5 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 6 Feb 2019 12:46:12 -0800 Subject: [PATCH] Fishing will no longer cancel the exp dropped for ice fishing and will no longer bring xp values below zero with the xp multiplier Not sure if this fixes the XP bug though! --- .../gmail/nossr50/listeners/PlayerListener.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 9a4d2f3f7..263b2598e 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -264,7 +264,9 @@ public class PlayerListener implements Listener { } if (Permissions.vanillaXpBoost(player, PrimarySkillType.FISHING)) { - event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop())); + //Don't modify XP below vanilla values + if(fishingManager.handleVanillaXpBoost(event.getExpToDrop()) > 1) + event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop())); } return; @@ -272,7 +274,9 @@ public class PlayerListener implements Listener { Block block = player.getTargetBlock(null, 100); if (fishingManager.canIceFish(block)) { - event.setCancelled(true); + + cancelFishingEventAndDropXp(event, player); + fishingManager.iceFishing(event.getHook(), block); } return; @@ -282,6 +286,12 @@ public class PlayerListener implements Listener { } } + private void cancelFishingEventAndDropXp(PlayerFishEvent event, Player player) { + event.setCancelled(true); + ExperienceOrb experienceOrb = (ExperienceOrb) player.getWorld().spawnEntity(player.getEyeLocation(), EntityType.EXPERIENCE_ORB); + experienceOrb.setExperience(event.getExpToDrop()); + } + /** * Monitor PlayerFishEvents. *

@@ -312,6 +322,7 @@ public class PlayerListener implements Listener { FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager(); Entity caught = event.getCaught(); + //event.setExpToDrop(event.getExpToDrop()); //Redundant? switch (event.getState()) { case FISHING: