From 7c0469dce19ac6d3f1ee9066dee0072c7632d23a Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 18 Mar 2019 09:19:38 -0700 Subject: [PATCH] Fix fishing exploit toggle --- .../gmail/nossr50/listeners/PlayerListener.java | 17 +++++++++++++---- 1 file changed, 13 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 57620ebc2..9990b61f4 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -326,13 +326,20 @@ public class PlayerListener implements Listener { FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager(); //Track the hook - if(ExperienceConfig.getInstance().isFishingExploitingPrevented()) + if(mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitFishing().isPreventFishingExploits()) { if(event.getHook().getMetadata(mcMMO.FISH_HOOK_REF_METAKEY).size() == 0) { fishingManager.setFishHookReference(event.getHook()); } + //Spam Fishing + if(event.getState() == PlayerFishEvent.State.CAUGHT_FISH && fishingManager.isFishingTooOften()) + { + event.setExpToDrop(0); + fishingManager.setFishHookReference(event.getHook()); + } + //Spam Fishing if(event.getState() == PlayerFishEvent.State.CAUGHT_FISH && fishingManager.isFishingTooOften()) { @@ -348,6 +355,7 @@ public class PlayerListener implements Listener { } } + switch (event.getState()) { case FISHING: if (fishingManager.canMasterAngler()) { @@ -356,7 +364,7 @@ public class PlayerListener implements Listener { } return; case CAUGHT_FISH: - if(ExperienceConfig.getInstance().isFishingExploitingPrevented()) + if(mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitFishing().isPreventFishingExploits()) { if(fishingManager.isExploitingFishing(event.getHook().getLocation().toVector())) { @@ -655,9 +663,9 @@ public class PlayerListener implements Listener { ItemStack heldItem = player.getInventory().getItemInMainHand(); //Spam Fishing Detection - if(event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) + if(mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitFishing().isPreventFishingExploits()) { - if(heldItem.getType() == Material.FISHING_ROD || player.getInventory().getItemInOffHand().getType() == Material.FISHING_ROD) + if(event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) { if(player.isInsideVehicle() && (player.getVehicle() instanceof Minecart || player.getVehicle() instanceof PoweredMinecart)) { @@ -669,6 +677,7 @@ public class PlayerListener implements Listener { } } + switch (event.getAction()) { case RIGHT_CLICK_BLOCK: if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {