This commit is contained in:
nossr50 2019-03-18 03:12:00 -07:00
parent bb118607ce
commit c8d95dc711
3 changed files with 20 additions and 8 deletions

View File

@ -8,14 +8,16 @@ Key:
- Removal
Version 2.1.19
Improved Fishing AFK detection
Greatly Improved Fishing AFK/Exploit Detection
Fixed a bug where Fishing AFK detection did not work on a new exploit
Certain exploits for Fishing now result in players losing small amounts of hunger and durability
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
Added messages to warn players about fishing in the same spot (Locale: Fishing.Scarcity)
Added messages to warn players who exploit in order to catch fish unusually fast (Locale: Fishing.Scared)
Added messages to warn players about casting the fishing rod too often (Locale: Fishing.Exhausting)
Version 2.1.18
You will need to add Kelp to your experience.yml file for this fix to be fully functional

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.19-SNAPSHOT</version>
<version>2.1.19</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>

View File

@ -25,6 +25,8 @@ import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -42,11 +44,13 @@ import org.bukkit.util.Vector;
import java.util.*;
public class FishingManager extends SkillManager {
public static final int FISHING_ROD_CAST_CD_MILLISECONDS = 200;
private final long FISHING_COOLDOWN_SECONDS = 1000L;
private long fishingRodCastTimestamp = 0L;
private long fishHookSpawnTimestamp = 0L;
private long lastWarned = 0L;
private long lastWarnedExhaust = 0L;
private FishHook fishHookReference;
private BoundingBox lastFishingBoundingBox;
private Item fishingCatch;
@ -66,17 +70,23 @@ public class FishingManager extends SkillManager {
public void setFishingRodCastTimestamp()
{
long currentTime = System.currentTimeMillis();
//Only track spam casting if the fishing hook is fresh
if(System.currentTimeMillis() > fishHookSpawnTimestamp + 500)
if(currentTime > fishHookSpawnTimestamp + 500)
return;
if(System.currentTimeMillis() < fishingRodCastTimestamp + 300)
if(currentTime < fishingRodCastTimestamp + FISHING_ROD_CAST_CD_MILLISECONDS)
{
getPlayer().setFoodLevel(Math.min(getPlayer().getFoodLevel() - 1, 0));
getPlayer().setFoodLevel(Math.max(getPlayer().getFoodLevel() - 1, 0));
getPlayer().getInventory().getItemInMainHand().setDurability((short) (getPlayer().getInventory().getItemInMainHand().getDurability() + 5));
getPlayer().updateInventory();
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Exhausting"));
if(lastWarnedExhaust + (1000 * 1) < currentTime)
{
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Exhausting"));
lastWarnedExhaust = currentTime;
SoundManager.sendSound(getPlayer(), getPlayer().getLocation(), SoundType.TIRED);
}
}
fishingRodCastTimestamp = System.currentTimeMillis();