mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
AFK Fishing protection
This commit is contained in:
parent
49a91617f0
commit
22c5280d4e
@ -9,6 +9,7 @@ Key:
|
|||||||
|
|
||||||
Version 2.1.1
|
Version 2.1.1
|
||||||
= Fixed an issue where excavation wasn't using the correct permission node
|
= Fixed an issue where excavation wasn't using the correct permission node
|
||||||
|
= Added protection against AFK fishing
|
||||||
|
|
||||||
Version 2.1.0
|
Version 2.1.0
|
||||||
+ mcMMO now features XP bars! Configurable in experience.yml
|
+ mcMMO now features XP bars! Configurable in experience.yml
|
||||||
|
@ -251,6 +251,9 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
||||||
|
|
||||||
|
if(fishingManager.exploitPrevention())
|
||||||
|
return;
|
||||||
|
|
||||||
switch (event.getState()) {
|
switch (event.getState()) {
|
||||||
case CAUGHT_FISH:
|
case CAUGHT_FISH:
|
||||||
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE:
|
//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();
|
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
||||||
|
|
||||||
|
if(fishingManager.exploitPrevention())
|
||||||
|
return;
|
||||||
|
|
||||||
Entity caught = event.getCaught();
|
Entity caught = event.getCaught();
|
||||||
|
|
||||||
switch (event.getState()) {
|
switch (event.getState()) {
|
||||||
|
@ -72,7 +72,8 @@ public class FishingManager extends SkillManager {
|
|||||||
|
|
||||||
Location targetLocation = targetBlock.getLocation();
|
Location targetLocation = targetBlock.getLocation();
|
||||||
boolean sameTarget = (fishingTarget != null && fishingTarget.equals(targetLocation));
|
boolean sameTarget = (fishingTarget != null && fishingTarget.equals(targetLocation));
|
||||||
return hasFished && sameTarget;
|
|
||||||
|
return hasFished || sameTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canIceFish(Block block) {
|
public boolean canIceFish(Block block) {
|
||||||
|
Loading…
Reference in New Issue
Block a user