mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Fishing is now more aggressive about over casting, added messages about fishing, removed vanilla rewards for exploiters
This commit is contained in:
parent
e3d2526939
commit
fef9058e16
@ -10,6 +10,9 @@ Key:
|
|||||||
Version 2.1.19
|
Version 2.1.19
|
||||||
Improved Fishing AFK detection
|
Improved Fishing AFK detection
|
||||||
Fixed a bug where Fishing AFK detection did not work on a new exploit
|
Fixed a bug where Fishing AFK detection did not work on a new exploit
|
||||||
|
Fishing now drops several hints to players if they are triggering the exploit detection
|
||||||
|
Added messages to warn players about fishing in the same spot
|
||||||
|
Added messages to warn players about casting too often
|
||||||
|
|
||||||
Version 2.1.18
|
Version 2.1.18
|
||||||
You will need to add Kelp to your experience.yml file for this fix to be fully functional
|
You will need to add Kelp to your experience.yml file for this fix to be fully functional
|
||||||
|
@ -29,7 +29,6 @@ import com.gmail.nossr50.util.sounds.SoundManager;
|
|||||||
import com.gmail.nossr50.util.sounds.SoundType;
|
import com.gmail.nossr50.util.sounds.SoundType;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -320,10 +319,23 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Entity caught = event.getCaught();
|
||||||
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
||||||
|
|
||||||
Entity caught = event.getCaught();
|
//Fishing Too Often
|
||||||
//event.setExpToDrop(event.getExpToDrop()); //Redundant?
|
if(event.getState() != PlayerFishEvent.State.CAUGHT_ENTITY && fishingManager.isFishingTooOften())
|
||||||
|
{
|
||||||
|
event.setExpToDrop(0);
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
if(caught instanceof Item)
|
||||||
|
{
|
||||||
|
Item caughtItem = (Item) caught;
|
||||||
|
caughtItem.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (event.getState()) {
|
switch (event.getState()) {
|
||||||
case FISHING:
|
case FISHING:
|
||||||
@ -333,8 +345,15 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case CAUGHT_FISH:
|
case CAUGHT_FISH:
|
||||||
if(fishingManager.exploitPrevention(event.getHook().getLocation().toVector()))
|
if(fishingManager.isExploitingFishing(event.getHook().getLocation().toVector()))
|
||||||
|
{
|
||||||
|
event.setExpToDrop(0);
|
||||||
|
event.setCancelled(true);
|
||||||
|
Item caughtItem = (Item) caught;
|
||||||
|
caughtItem.remove();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fishingManager.handleFishing((Item) caught);
|
fishingManager.handleFishing((Item) caught);
|
||||||
fishingManager.setFishingTarget();
|
fishingManager.setFishingTarget();
|
||||||
return;
|
return;
|
||||||
|
@ -15,6 +15,7 @@ import com.gmail.nossr50.datatypes.treasure.Rarity;
|
|||||||
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
||||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
||||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
|
||||||
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.*;
|
import com.gmail.nossr50.util.*;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
@ -59,7 +60,21 @@ public class FishingManager extends SkillManager {
|
|||||||
return getSkillLevel() >= RankUtils.getUnlockLevel(SubSkillType.FISHING_MASTER_ANGLER) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_MASTER_ANGLER);
|
return getSkillLevel() >= RankUtils.getUnlockLevel(SubSkillType.FISHING_MASTER_ANGLER) && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.FISHING_MASTER_ANGLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean exploitPrevention(Vector centerOfCastVector) {
|
public boolean isFishingTooOften()
|
||||||
|
{
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
|
boolean hasFished = (currentTime < fishingTimestamp + (FISHING_COOLDOWN_SECONDS * 10));
|
||||||
|
|
||||||
|
if(hasFished)
|
||||||
|
{
|
||||||
|
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Scared"));
|
||||||
|
fishingTimestamp = currentTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasFished;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isExploitingFishing(Vector centerOfCastVector) {
|
||||||
|
|
||||||
/*Block targetBlock = getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
|
/*Block targetBlock = getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
|
||||||
|
|
||||||
@ -70,12 +85,6 @@ public class FishingManager extends SkillManager {
|
|||||||
if(lastFishingBoundingBox == null)
|
if(lastFishingBoundingBox == null)
|
||||||
lastFishingBoundingBox = makeBoundingBox(centerOfCastVector);
|
lastFishingBoundingBox = makeBoundingBox(centerOfCastVector);
|
||||||
|
|
||||||
long currentTime = System.currentTimeMillis();
|
|
||||||
boolean hasFished = (currentTime < fishingTimestamp + (FISHING_COOLDOWN_SECONDS * 10));
|
|
||||||
|
|
||||||
if(hasFished)
|
|
||||||
fishingTimestamp = currentTime;
|
|
||||||
|
|
||||||
BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector);
|
BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector);
|
||||||
|
|
||||||
boolean sameTarget = lastFishingBoundingBox.overlaps(newCastBoundingBox);
|
boolean sameTarget = lastFishingBoundingBox.overlaps(newCastBoundingBox);
|
||||||
@ -83,8 +92,12 @@ public class FishingManager extends SkillManager {
|
|||||||
//If the new bounding box does not intersect with the old one, then update our bounding box reference
|
//If the new bounding box does not intersect with the old one, then update our bounding box reference
|
||||||
if(!sameTarget)
|
if(!sameTarget)
|
||||||
lastFishingBoundingBox = newCastBoundingBox;
|
lastFishingBoundingBox = newCastBoundingBox;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Scarcity"));
|
||||||
|
}
|
||||||
|
|
||||||
return hasFished || sameTarget;
|
return sameTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BoundingBox makeBoundingBox(Vector centerOfCastVector) {
|
public static BoundingBox makeBoundingBox(Vector centerOfCastVector) {
|
||||||
|
@ -217,6 +217,8 @@ Excavation.Skills.GigaDrillBreaker.Refresh=[[GREEN]]Your [[YELLOW]]Giga Drill Br
|
|||||||
Excavation.Skills.GigaDrillBreaker.Other.Off=Giga Drill Breaker[[GREEN]] has worn off for [[YELLOW]]{0}
|
Excavation.Skills.GigaDrillBreaker.Other.Off=Giga Drill Breaker[[GREEN]] has worn off for [[YELLOW]]{0}
|
||||||
Excavation.Skills.GigaDrillBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Giga Drill Breaker!
|
Excavation.Skills.GigaDrillBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Giga Drill Breaker!
|
||||||
#FISHING
|
#FISHING
|
||||||
|
Fishing.Scarcity=[[YELLOW]]&oThis area is suffering from overfishing, try fishing in a new area.
|
||||||
|
Fishing.Scared=[[GRAY]]&oChaotic movements will scare fish!
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user