Unarmed now has some spam detection

Fixed an error in the skillranks.yml file as well
This commit is contained in:
nossr50 2019-02-03 13:17:42 -08:00
parent 84b3cfc309
commit 371a3ceec7
7 changed files with 25 additions and 14 deletions

View File

@ -8,6 +8,7 @@ Key:
- Removal
Version 2.1.7
Fixed an almost 6 year old bug where Salvage materials did not have a defined material count so they defaulted to 2 (which could lead to shovels giving back more diamonds than normal)
Added spam detection for Unarmed's bonus damage and disarm
(API) Added addXpFromBlocks to ExperienceAPI to help make adding XP for a player easier
(API) Added addXpFromBlocksBySkill to ExperienceAPI to help make adding XP for a player easier
(API) Added addXpFromBlock to ExperienceAPI to help make adding XP for a player easier

View File

@ -12,13 +12,10 @@ public class Taming {
public static int goreBleedTicks = 2; //Equivalent to rank 1 in Rupture
public static double goreModifier = AdvancedConfig.getInstance().getGoreModifier();
public static int sharpenedClawsUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_SHARPENED_CLAWS);
public static double sharpenedClawsBonusDamage = AdvancedConfig.getInstance().getSharpenedClawsBonus();
public static int shockProofUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_SHOCK_PROOF);
public static double shockProofModifier = AdvancedConfig.getInstance().getShockProofModifier();
public static int thickFurUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.TAMING_THICK_FUR);
public static double thickFurModifier = AdvancedConfig.getInstance().getThickFurModifier();
public static boolean canPreventDamage(Tameable pet, AnimalTamer owner) {

View File

@ -65,7 +65,8 @@ public class TamingManager extends SkillManager {
}
public boolean canUseSharpenedClaws() {
return getSkillLevel() >= Taming.sharpenedClawsUnlockLevel && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_SHARPENED_CLAWS);
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_SHARPENED_CLAWS)
&& Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.TAMING_SHARPENED_CLAWS);
}
public boolean canUseGore() {

View File

@ -10,8 +10,9 @@ import org.bukkit.inventory.ItemStack;
public class Unarmed {
public static boolean blockCrackerSmoothBrick = Config.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
public static double berserkDamageModifier = 1.5;
public static long lastAttacked = 0;
public static long attackInterval = 750;
public static void handleItemPickup(Player player, EntityPickupItemEvent event) {
ItemStack[] storageContents = player.getInventory().getStorageContents();

View File

@ -146,6 +146,10 @@ public class UnarmedManager extends SkillManager {
return getIronArmDamage();
}
public boolean isPunchingCooldownOver() {
return (Unarmed.lastAttacked + Unarmed.attackInterval) <= System.currentTimeMillis();
}
public double getIronArmDamage() {
return RankUtils.getRank(getPlayer(), SubSkillType.UNARMED_IRON_ARM_STYLE) * 2;
}

View File

@ -17,6 +17,7 @@ import com.gmail.nossr50.skills.archery.ArcheryManager;
import com.gmail.nossr50.skills.axes.AxesManager;
import com.gmail.nossr50.skills.swords.SwordsManager;
import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.skills.unarmed.Unarmed;
import com.gmail.nossr50.skills.unarmed.UnarmedManager;
import com.gmail.nossr50.util.*;
import com.gmail.nossr50.util.player.NotificationManager;
@ -122,6 +123,9 @@ public final class CombatUtils {
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
}
//Only execute bonuses if the player is not spamming
if(unarmedManager.isPunchingCooldownOver())
{
if (unarmedManager.canUseIronArm()) {
finalDamage += unarmedManager.ironArm();
}
@ -133,9 +137,12 @@ public final class CombatUtils {
if (unarmedManager.canDisarm(target)) {
unarmedManager.disarmCheck((Player) target);
}
}
applyScaledModifiers(initialDamage, finalDamage, event);
startGainXp(mcMMOPlayer, target, PrimarySkillType.UNARMED);
Unarmed.lastAttacked = System.currentTimeMillis(); //Track how often the player is punching
}
private static void processTamingCombat(LivingEntity target, Player master, Wolf wolf, EntityDamageByEntityEvent event) {

View File

@ -338,7 +338,7 @@ Fishing:
Standard:
Rank_1: 50
RetroMode:
Rank_1: 150
Rank_1: 500
IceFishing:
Standard:
Rank_1: 5