mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	wire up alerting admins to over-fishing repeated abuse
This commit is contained in:
		@@ -20,6 +20,8 @@ Version 2.2.0
 | 
				
			|||||||
    All config nodes now include a comment with the default value of the node to use as reference
 | 
					    All config nodes now include a comment with the default value of the node to use as reference
 | 
				
			||||||
    Expanded settings relating to purging users who have not leveled or users who had not logged in for many months
 | 
					    Expanded settings relating to purging users who have not leveled or users who had not logged in for many months
 | 
				
			||||||
    NOTE: Not every config key that was renamed will be listed here
 | 
					    NOTE: Not every config key that was renamed will be listed here
 | 
				
			||||||
 | 
					    Admins will now be notified if a player trips over-fishing exploit detection 3+ times in a row (Locale: "Fishing.OverFishingDetected")
 | 
				
			||||||
 | 
					        Note: Admins are players who are op or have adminchat permission.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Bug Fixes
 | 
					    Bug Fixes
 | 
				
			||||||
    Fixed a bug where players who started at level 1 would not be purged from the DB for being "powerless"
 | 
					    Fixed a bug where players who started at level 1 would not be purged from the DB for being "powerless"
 | 
				
			||||||
@@ -85,6 +87,9 @@ Version 2.2.0
 | 
				
			|||||||
    Added toggle for acrobatics exploit prevention
 | 
					    Added toggle for acrobatics exploit prevention
 | 
				
			||||||
    Added customizable limit for the number of locations acrobatics tracks for exploit prevention
 | 
					    Added customizable limit for the number of locations acrobatics tracks for exploit prevention
 | 
				
			||||||
    Added toggle for fishing exploit prevention
 | 
					    Added toggle for fishing exploit prevention
 | 
				
			||||||
 | 
					    Added settings for how many fish can be caught at a location before it is over-fished
 | 
				
			||||||
 | 
					    Added settings for how large of an area can be over-fished
 | 
				
			||||||
 | 
					    Added settings for how often a fishing rod has to be spammed to trigger abuse detection
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Settings related to Player Leveling are now found in "player_leveling.conf"
 | 
					    Settings related to Player Leveling are now found in "player_leveling.conf"
 | 
				
			||||||
    Player Leveling's "TruncateSkills" renamed -> "Reduce-Player-Skills-Above-Cap"
 | 
					    Player Leveling's "TruncateSkills" renamed -> "Reduce-Player-Skills-Above-Cap"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,16 +38,12 @@ import com.gmail.nossr50.skills.salvage.salvageables.SimpleSalvageableManager;
 | 
				
			|||||||
import com.gmail.nossr50.util.experience.ExperienceMapManager;
 | 
					import com.gmail.nossr50.util.experience.ExperienceMapManager;
 | 
				
			||||||
import com.google.common.collect.Maps;
 | 
					import com.google.common.collect.Maps;
 | 
				
			||||||
import com.google.common.reflect.TypeToken;
 | 
					import com.google.common.reflect.TypeToken;
 | 
				
			||||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
 | 
					 | 
				
			||||||
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializerCollection;
 | 
					 | 
				
			||||||
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers;
 | 
					import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers;
 | 
				
			||||||
import org.bukkit.Material;
 | 
					import org.bukkit.Material;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.File;
 | 
					import java.io.File;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.HashMap;
 | 
					import java.util.HashMap;
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.UUID;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,17 +3,13 @@ package com.gmail.nossr50.config.hocon;
 | 
				
			|||||||
import com.gmail.nossr50.config.ConfigConstants;
 | 
					import com.gmail.nossr50.config.ConfigConstants;
 | 
				
			||||||
import com.gmail.nossr50.mcMMO;
 | 
					import com.gmail.nossr50.mcMMO;
 | 
				
			||||||
import ninja.leaping.configurate.ConfigurationOptions;
 | 
					import ninja.leaping.configurate.ConfigurationOptions;
 | 
				
			||||||
import ninja.leaping.configurate.SimpleConfigurationNode;
 | 
					 | 
				
			||||||
import ninja.leaping.configurate.ValueType;
 | 
					import ninja.leaping.configurate.ValueType;
 | 
				
			||||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
 | 
					import ninja.leaping.configurate.commented.CommentedConfigurationNode;
 | 
				
			||||||
import ninja.leaping.configurate.commented.SimpleCommentedConfigurationNode;
 | 
					import ninja.leaping.configurate.commented.SimpleCommentedConfigurationNode;
 | 
				
			||||||
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
 | 
					import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
 | 
				
			||||||
import ninja.leaping.configurate.objectmapping.DefaultObjectMapperFactory;
 | 
					 | 
				
			||||||
import ninja.leaping.configurate.objectmapping.ObjectMapper;
 | 
					import ninja.leaping.configurate.objectmapping.ObjectMapper;
 | 
				
			||||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
 | 
					import ninja.leaping.configurate.objectmapping.ObjectMappingException;
 | 
				
			||||||
import ninja.leaping.configurate.objectmapping.serialize.TypeSerializers;
 | 
					 | 
				
			||||||
import ninja.leaping.configurate.util.ConfigurationNodeWalker;
 | 
					import ninja.leaping.configurate.util.ConfigurationNodeWalker;
 | 
				
			||||||
import ninja.leaping.configurate.util.MapFactories;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.File;
 | 
					import java.io.File;
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,8 @@ public class ConfigSectionExploitFishing {
 | 
				
			|||||||
    @Setting(value = "Overfishing-Limit", comment = "How many times a player can fish in the same spot before it becomes over-fished" +
 | 
					    @Setting(value = "Overfishing-Limit", comment = "How many times a player can fish in the same spot before it becomes over-fished" +
 | 
				
			||||||
            "\nOver fishing is in place to prevent 99% of AFK fishing from working." +
 | 
					            "\nOver fishing is in place to prevent 99% of AFK fishing from working." +
 | 
				
			||||||
            "\nFishing in a new spot is all it takes to remove over-fishing from your previous location." +
 | 
					            "\nFishing in a new spot is all it takes to remove over-fishing from your previous location." +
 | 
				
			||||||
            "\nOver-fishing is based on where your fishing bobber actually lands and catches fish, it has nothing to do with where you are standing.")
 | 
					            "\nOver-fishing is based on where your fishing bobber actually lands and catches fish, it has nothing to do with where you are standing." +
 | 
				
			||||||
 | 
					            "\nDefault value: "+OVER_FISHING_LIMIT_DEFAULT)
 | 
				
			||||||
    private int overfishingLimit = OVER_FISHING_LIMIT_DEFAULT;
 | 
					    private int overfishingLimit = OVER_FISHING_LIMIT_DEFAULT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Setting(value = "Overfishing-Area-Size-Radius", comment = "Over-Fishing tracks where you've caught fish from by making a bounding box around where your fishing rod's bobber lands." +
 | 
					    @Setting(value = "Overfishing-Area-Size-Radius", comment = "Over-Fishing tracks where you've caught fish from by making a bounding box around where your fishing rod's bobber lands." +
 | 
				
			||||||
@@ -30,12 +31,13 @@ public class ConfigSectionExploitFishing {
 | 
				
			|||||||
            "\nI wouldn't recommend making this value too large or it will be very troublesome for your players to fish." +
 | 
					            "\nI wouldn't recommend making this value too large or it will be very troublesome for your players to fish." +
 | 
				
			||||||
            "\nA value of 1.0 would result in a bounding box that is 2.0 units (blocks) in size" +
 | 
					            "\nA value of 1.0 would result in a bounding box that is 2.0 units (blocks) in size" +
 | 
				
			||||||
            "\nWhen you catch a new fish it makes a new bounding box at that location and checks to see if it overlaps with the bounding box of the last place you caught a fish," +
 | 
					            "\nWhen you catch a new fish it makes a new bounding box at that location and checks to see if it overlaps with the bounding box of the last place you caught a fish," +
 | 
				
			||||||
            "  if they intersect then that increases your fish counter, if you are at your fishing limit then you get nothing." +
 | 
					            "\n    if they intersect then that increases your fish counter, if you are at your fishing limit then you get nothing." +
 | 
				
			||||||
            "\nDefault value: "+OVER_FISHING_SIZE)
 | 
					            "\nDefault value: "+OVER_FISHING_SIZE)
 | 
				
			||||||
    private float overFishingAreaSize = OVER_FISHING_SIZE;
 | 
					    private float overFishingAreaSize = OVER_FISHING_SIZE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Setting(value = "Alert-Admins-To-Overfishing-Abuse", comment = "If someone is triggering over-fishing exploit detection too often, alert admins." +
 | 
					    @Setting(value = "Alert-Admins-To-Overfishing-Abuse", comment = "If someone is triggering over-fishing exploit detection too often, alert admins." +
 | 
				
			||||||
            "\nThis will send a message to ops in game and to the console, and to anyone with the admin chat permission node.")
 | 
					            "\nThis will send a message to ops in game and to the console, and to anyone with the admin chat permission node." +
 | 
				
			||||||
 | 
					            "\nDefault value: "+ADMINS_OVER_FISHING_DEFAULT)
 | 
				
			||||||
    private boolean alertAdminsOnOverFishing = ADMINS_OVER_FISHING_DEFAULT;
 | 
					    private boolean alertAdminsOnOverFishing = ADMINS_OVER_FISHING_DEFAULT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Setting(value = "Fishing-Rod-Spam-Threshold-In-Milliseconds", comment = "How many milliseconds in between casting the fishing rod before a player suffers from fatigue." +
 | 
					    @Setting(value = "Fishing-Rod-Spam-Threshold-In-Milliseconds", comment = "How many milliseconds in between casting the fishing rod before a player suffers from fatigue." +
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,6 +27,7 @@ import com.gmail.nossr50.util.skills.RankUtils;
 | 
				
			|||||||
import com.gmail.nossr50.util.skills.SkillUtils;
 | 
					import com.gmail.nossr50.util.skills.SkillUtils;
 | 
				
			||||||
import com.gmail.nossr50.util.sounds.SoundManager;
 | 
					import com.gmail.nossr50.util.sounds.SoundManager;
 | 
				
			||||||
import com.gmail.nossr50.util.sounds.SoundType;
 | 
					import com.gmail.nossr50.util.sounds.SoundType;
 | 
				
			||||||
 | 
					import org.bukkit.Bukkit;
 | 
				
			||||||
import org.bukkit.Location;
 | 
					import org.bukkit.Location;
 | 
				
			||||||
import org.bukkit.Material;
 | 
					import org.bukkit.Material;
 | 
				
			||||||
import org.bukkit.block.Block;
 | 
					import org.bukkit.block.Block;
 | 
				
			||||||
@@ -56,6 +57,7 @@ public class FishingManager extends SkillManager {
 | 
				
			|||||||
    private Location hookLocation;
 | 
					    private Location hookLocation;
 | 
				
			||||||
    private int fishCaughtCounter = 1;
 | 
					    private int fishCaughtCounter = 1;
 | 
				
			||||||
    private final float boundingBoxSize;
 | 
					    private final float boundingBoxSize;
 | 
				
			||||||
 | 
					    private int overFishCount = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public FishingManager(McMMOPlayer mcMMOPlayer) {
 | 
					    public FishingManager(McMMOPlayer mcMMOPlayer) {
 | 
				
			||||||
        super(mcMMOPlayer, PrimarySkillType.FISHING);
 | 
					        super(mcMMOPlayer, PrimarySkillType.FISHING);
 | 
				
			||||||
@@ -147,6 +149,23 @@ public class FishingManager extends SkillManager {
 | 
				
			|||||||
        if(!sameTarget)
 | 
					        if(!sameTarget)
 | 
				
			||||||
            lastFishingBoundingBox = newCastBoundingBox;
 | 
					            lastFishingBoundingBox = newCastBoundingBox;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(sameTarget && fishCaughtCounter >= OVERFISH_LIMIT)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            overFishCount++;
 | 
				
			||||||
 | 
					        } else
 | 
				
			||||||
 | 
					            overFishCount=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(overFishCount == 2)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            for(Player player : Bukkit.getOnlinePlayers())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if(player.isOp() || Permissions.adminChat(player))
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    player.sendMessage(LocaleLoader.getString("Fishing.OverFishingDetected", getPlayer().getDisplayName()));
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return sameTarget && fishCaughtCounter >= OVERFISH_LIMIT;
 | 
					        return sameTarget && fishCaughtCounter >= OVERFISH_LIMIT;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -227,6 +227,7 @@ Fishing.Scarcity=[[YELLOW]]&oThis area is suffering from overfishing, try fishin
 | 
				
			|||||||
Fishing.Scared=[[GRAY]]&oChaotic movements will scare fish!
 | 
					Fishing.Scared=[[GRAY]]&oChaotic movements will scare fish!
 | 
				
			||||||
Fishing.Exhausting=[[RED]]&oImproper use of the fishing rod will cause fatigue and wear out the rod!
 | 
					Fishing.Exhausting=[[RED]]&oImproper use of the fishing rod will cause fatigue and wear out the rod!
 | 
				
			||||||
Fishing.LowResources=[[GRAY]]You sense that there might not be many fish left in this area.
 | 
					Fishing.LowResources=[[GRAY]]You sense that there might not be many fish left in this area.
 | 
				
			||||||
 | 
					Fishing.OverFishingDetected=[[YELLOW]]Player named &r{0}[[YELLOW]]has over-fished three times in a row at the same location, potential abuse detected.
 | 
				
			||||||
Fishing.Ability.Info=Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank**
 | 
					Fishing.Ability.Info=Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank**
 | 
				
			||||||
Fishing.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (SHAKE)
 | 
					Fishing.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (SHAKE)
 | 
				
			||||||
Fishing.Ability.Locked.1=LOCKED UNTIL {0}+ SKILL (ICE FISHING)
 | 
					Fishing.Ability.Locked.1=LOCKED UNTIL {0}+ SKILL (ICE FISHING)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user