mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Fix fishing exploit prevention
This commit is contained in:
parent
3a4de97c9b
commit
4a5bcaa92d
@ -78,8 +78,15 @@ public class FishingManager extends SkillManager {
|
|||||||
|
|
||||||
if(currentTime < fishingRodCastTimestamp + FISHING_ROD_CAST_CD_MILLISECONDS)
|
if(currentTime < fishingRodCastTimestamp + FISHING_ROD_CAST_CD_MILLISECONDS)
|
||||||
{
|
{
|
||||||
|
ItemStack fishingRod = getPlayer().getInventory().getItemInMainHand();
|
||||||
|
|
||||||
|
//Ensure correct hand item is damaged
|
||||||
|
if(fishingRod.getType() != Material.FISHING_ROD) {
|
||||||
|
fishingRod = getPlayer().getInventory().getItemInOffHand();
|
||||||
|
}
|
||||||
|
|
||||||
getPlayer().setFoodLevel(Math.max(getPlayer().getFoodLevel() - 1, 0));
|
getPlayer().setFoodLevel(Math.max(getPlayer().getFoodLevel() - 1, 0));
|
||||||
getPlayer().getInventory().getItemInMainHand().setDurability((short) (getPlayer().getInventory().getItemInMainHand().getDurability() + 5));
|
fishingRod.setDurability((short) (fishingRod.getDurability() + 5));
|
||||||
getPlayer().updateInventory();
|
getPlayer().updateInventory();
|
||||||
|
|
||||||
if(lastWarnedExhaust + (1000 * 1) < currentTime)
|
if(lastWarnedExhaust + (1000 * 1) < currentTime)
|
||||||
|
Loading…
Reference in New Issue
Block a user