Browse Source

Smaller bounds on fishing scarcity

nossr50 6 years ago
parent
commit
2d849f55e5

+ 3 - 0
Changelog.txt

@@ -10,7 +10,10 @@ Key:
 Version 2.1.19
     Improved Fishing AFK detection
     Fixed a bug where Fishing AFK detection did not work on a new exploit
+    Players who get detected by Fishing's anti-exploit measures will no longer get vanilla rewards from Minecraft
+        **Note: Previously if mcMMO detected you abusing Fishing it just switched you over to vanilla Minecraft fishing rewards, this change is to help server admins who don't want players to get any kind of reward from AFK fishing
     Fishing now drops several hints to players if they are triggering the exploit detection
+        **Note: Not all types of exploit detection will warn players, this is just to prevent legitimate fishers from being confused by the aggressive exploit detection.
     Added messages to warn players about fishing in the same spot
     Added messages to warn players about casting too often
 

+ 6 - 3
src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java

@@ -44,6 +44,7 @@ public class FishingManager extends SkillManager {
     private final long FISHING_COOLDOWN_SECONDS = 1000L;
 
     private long fishingTimestamp = 0L;
+    private long lastWarned = 0L;
     private BoundingBox lastFishingBoundingBox;
     private Item fishingCatch;
     private Location hookLocation;
@@ -65,12 +66,14 @@ public class FishingManager extends SkillManager {
         long currentTime = System.currentTimeMillis();
         boolean hasFished = (currentTime < fishingTimestamp + (FISHING_COOLDOWN_SECONDS * 10));
 
-        if(hasFished)
+        if(hasFished && lastWarned + (1000 * 5) < System.currentTimeMillis())
         {
             getPlayer().sendMessage(LocaleLoader.getString("Fishing.Scared"));
-            fishingTimestamp = currentTime;
+            lastWarned = System.currentTimeMillis();
         }
 
+        fishingTimestamp = currentTime;
+
         return hasFished;
     }
 
@@ -101,7 +104,7 @@ public class FishingManager extends SkillManager {
     }
 
     public static BoundingBox makeBoundingBox(Vector centerOfCastVector) {
-        return BoundingBox.of(centerOfCastVector, 2, 2, 2);
+        return BoundingBox.of(centerOfCastVector, 1, 1, 1);
     }
 
     public void setFishingTarget() {