AFK Fishing protection

This commit is contained in:
nossr50 2019-01-26 14:25:01 -08:00
parent 49a91617f0
commit 22c5280d4e
3 changed files with 10 additions and 1 deletions

View File

@ -9,6 +9,7 @@ Key:
Version 2.1.1
= Fixed an issue where excavation wasn't using the correct permission node
= Added protection against AFK fishing
Version 2.1.0
+ mcMMO now features XP bars! Configurable in experience.yml

View File

@ -251,6 +251,9 @@ public class PlayerListener implements Listener {
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
if(fishingManager.exploitPrevention())
return;
switch (event.getState()) {
case CAUGHT_FISH:
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE:
@ -311,6 +314,10 @@ public class PlayerListener implements Listener {
}
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
if(fishingManager.exploitPrevention())
return;
Entity caught = event.getCaught();
switch (event.getState()) {

View File

@ -72,7 +72,8 @@ public class FishingManager extends SkillManager {
Location targetLocation = targetBlock.getLocation();
boolean sameTarget = (fishingTarget != null && fishingTarget.equals(targetLocation));
return hasFished && sameTarget;
return hasFished || sameTarget;
}
public boolean canIceFish(Block block) {