SecondaryAbility's API additions

This commit is contained in:
t00thpick1
2013-11-22 12:32:23 -05:00
parent 5d63a4b910
commit 870987bba7
60 changed files with 658 additions and 596 deletions

View File

@ -29,10 +29,6 @@ public abstract class SkillManager {
return mcMMOPlayer.getSkillLevel(skill);
}
public int getActivationChance() {
return activationChance;
}
public void applyXpGain(float xp) {
mcMMOPlayer.beginXpGain(skill, xp);
}

View File

@ -5,17 +5,9 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
public final class Acrobatics {
public static int dodgeMaxBonusLevel = AdvancedConfig.getInstance().getDodgeMaxBonusLevel();
public static double dodgeDamageModifier = AdvancedConfig.getInstance().getDodgeDamageModifier();
public static double dodgeMaxChance = AdvancedConfig.getInstance().getDodgeChanceMax();
public static int rollMaxBonusLevel = AdvancedConfig.getInstance().getRollMaxBonusLevel();
public static double rollThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
public static double rollMaxChance = AdvancedConfig.getInstance().getRollChanceMax();
public static int gracefulRollMaxBonusLevel = AdvancedConfig.getInstance().getGracefulRollMaxBonusLevel();
public static double gracefulRollThreshold = AdvancedConfig.getInstance().getGracefulRollDamageThreshold();
public static double gracefulRollMaxChance = AdvancedConfig.getInstance().getGracefulRollChanceMax();
public static double rollThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
public static double gracefulRollThreshold = AdvancedConfig.getInstance().getGracefulRollDamageThreshold();
public static double dodgeDamageModifier = AdvancedConfig.getInstance().getDodgeDamageModifier();
public static int dodgeXpModifier = ExperienceConfig.getInstance().getDodgeXPModifier();
public static int rollXpModifier = ExperienceConfig.getInstance().getRollXPModifier();

View File

@ -10,6 +10,7 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillManager;
@ -27,11 +28,11 @@ public class AcrobaticsManager extends SkillManager {
}
public boolean canRoll() {
return !exploitPrevention() && Permissions.roll(getPlayer());
return !exploitPrevention() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.ROLL);
}
public boolean canDodge(Entity damager) {
if (Permissions.dodge(getPlayer())) {
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.DODGE)) {
if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) {
return false;
}
@ -52,7 +53,7 @@ public class AcrobaticsManager extends SkillManager {
double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier);
Player player = getPlayer();
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Acrobatics.dodgeMaxChance, Acrobatics.dodgeMaxBonusLevel)) {
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbilityType.DODGE, player, getSkillLevel(), activationChance)) {
ParticleEffectUtils.playDodgeEffect(player);
if (mcMMOPlayer.useChatNotifications()) {
@ -79,13 +80,13 @@ public class AcrobaticsManager extends SkillManager {
public double rollCheck(double damage) {
Player player = getPlayer();
if (player.isSneaking() && Permissions.gracefulRoll(player)) {
if (player.isSneaking() && Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.GRACEFUL_ROLL)) {
return gracefulRollCheck(damage);
}
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.rollThreshold);
if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.rollMaxChance, Acrobatics.rollMaxBonusLevel)) {
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbilityType.ROLL, player, getSkillLevel(), activationChance)) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
applyXpGain(calculateRollXP(damage, true));
@ -109,7 +110,7 @@ public class AcrobaticsManager extends SkillManager {
private double gracefulRollCheck(double damage) {
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.gracefulRollThreshold);
if (!isFatal(modifiedDamage) && isSuccessfulRoll(Acrobatics.gracefulRollMaxChance, Acrobatics.gracefulRollMaxBonusLevel)) {
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbilityType.GRACEFUL_ROLL, getPlayer(), getSkillLevel(), activationChance)) {
getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc"));
applyXpGain(calculateRollXP(damage, true));
@ -149,10 +150,6 @@ public class AcrobaticsManager extends SkillManager {
return fallTries > Config.getInstance().getAcrobaticsAFKMaxTries();
}
private boolean isSuccessfulRoll(double maxChance, int maxLevel) {
return (maxChance / maxLevel) * Math.min(getSkillLevel(), maxLevel) > Misc.getRandom().nextInt(activationChance);
}
private boolean isFatal(double damage) {
return getPlayer().getHealth() - damage < 1;
}

View File

@ -16,17 +16,12 @@ import com.gmail.nossr50.util.Misc;
public class Archery {
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
public static int retrieveMaxBonusLevel = AdvancedConfig.getInstance().getRetrieveMaxBonusLevel();
public static double retrieveMaxChance = AdvancedConfig.getInstance().getRetrieveChanceMax();
public static int skillShotIncreaseLevel = AdvancedConfig.getInstance().getSkillShotIncreaseLevel();
public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotIncreasePercentage();
public static double skillShotMaxBonusPercentage = AdvancedConfig.getInstance().getSkillShotBonusMax();
public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
public static int dazeMaxBonusLevel = AdvancedConfig.getInstance().getDazeMaxBonusLevel();
public static double dazeModifier = AdvancedConfig.getInstance().getDazeModifier();
public static double dazeMaxBonus = AdvancedConfig.getInstance().getDazeBonusMax();
public static final double DISTANCE_XP_MULTIPLIER = 0.025;

View File

@ -11,6 +11,7 @@ import org.bukkit.potion.PotionEffectType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillManager;
@ -26,15 +27,15 @@ public class ArcheryManager extends SkillManager {
}
public boolean canDaze(LivingEntity target) {
return target instanceof Player && Permissions.daze(getPlayer());
return target instanceof Player && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.DAZE);
}
public boolean canSkillShot() {
return getSkillLevel() >= Archery.skillShotIncreaseLevel && Permissions.bonusDamage(getPlayer(), skill);
return getSkillLevel() >= Archery.skillShotIncreaseLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.SKILL_SHOT);
}
public boolean canTrackArrows() {
return Permissions.arrowRetrieval(getPlayer());
public boolean canRetrieveArrows() {
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.RETRIEVE);
}
/**
@ -59,8 +60,8 @@ public class ArcheryManager extends SkillManager {
*
* @param target The {@link LivingEntity} damaged by the arrow
*/
public void trackArrows(LivingEntity target) {
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.retrieveMaxChance, Archery.retrieveMaxBonusLevel)) {
public void retrieveArrows(LivingEntity target) {
if (SkillUtils.activationSuccessful(SecondaryAbilityType.RETRIEVE, getPlayer(), getSkillLevel(), activationChance)) {
Archery.incrementTrackerValue(target);
}
}
@ -72,7 +73,7 @@ public class ArcheryManager extends SkillManager {
* @param arrow The {@link Arrow} that was fired
*/
public double daze(Player defender, Arrow arrow) {
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Archery.dazeMaxBonus, Archery.dazeMaxBonusLevel)) {
if (!SkillUtils.activationSuccessful(SecondaryAbilityType.DAZE, getPlayer(), getSkillLevel(), activationChance)) {
return 0;
}

View File

@ -7,13 +7,11 @@ import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.util.ItemUtils;
public class Axes {
public static double bonusDamageMaxBonus = AdvancedConfig.getInstance().getBonusDamageAxesBonusMax();
public static int bonusDamageMaxBonusLevel = AdvancedConfig.getInstance().getBonusDamageAxesMaxBonusLevel();
public static double axeMasteryMaxBonus = AdvancedConfig.getInstance().getAxeMasteryBonusMax();
public static int axeMasteryMaxBonusLevel = AdvancedConfig.getInstance().getAxeMasteryMaxBonusLevel();
public static int criticalHitMaxBonusLevel = AdvancedConfig.getInstance().getAxesCriticalMaxBonusLevel();
public static double criticalHitMaxChance = AdvancedConfig.getInstance().getAxesCriticalChance();
public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getAxesCriticalPVPModifier();
public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getAxesCriticalPVEModifier();
public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getCriticalHitPVPModifier();
public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getCriticalHitPVEModifier();
public static int impactIncreaseLevel = AdvancedConfig.getInstance().getArmorImpactIncreaseLevel();
public static double impactChance = AdvancedConfig.getInstance().getImpactChance();

View File

@ -4,10 +4,13 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.ItemUtils;
@ -24,19 +27,19 @@ public class AxesManager extends SkillManager {
}
public boolean canUseAxeMastery() {
return Permissions.bonusDamage(getPlayer(), skill);
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.AXE_MASTERY);
}
public boolean canCriticalHit(LivingEntity target) {
return target.isValid() && Permissions.criticalStrikes(getPlayer());
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.CRITICAL_HIT);
}
public boolean canImpact(LivingEntity target) {
return target.isValid() && Permissions.armorImpact(getPlayer()) && Axes.hasArmor(target);
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.ARMOR_IMPACT) && Axes.hasArmor(target);
}
public boolean canGreaterImpact(LivingEntity target) {
return target.isValid() && Permissions.greaterImpact(getPlayer()) && !Axes.hasArmor(target);
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.GREATER_IMPACT) && !Axes.hasArmor(target);
}
public boolean canUseSkullSplitter(LivingEntity target) {
@ -53,7 +56,7 @@ public class AxesManager extends SkillManager {
* @param target The {@link LivingEntity} being affected by the ability
*/
public double axeMastery(LivingEntity target) {
double axeBonus = Math.min(getSkillLevel() / (Axes.bonusDamageMaxBonusLevel / Axes.bonusDamageMaxBonus), Axes.bonusDamageMaxBonus);
double axeBonus = Math.min(getSkillLevel() / (Axes.axeMasteryMaxBonusLevel / Axes.axeMasteryMaxBonus), Axes.axeMasteryMaxBonus);
return CombatUtils.callFakeDamageEvent(getPlayer(), target, axeBonus);
}
@ -65,7 +68,7 @@ public class AxesManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event
*/
public double criticalHit(LivingEntity target, double damage) {
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Axes.criticalHitMaxChance, Axes.criticalHitMaxBonusLevel)) {
if (!SkillUtils.activationSuccessful(SecondaryAbilityType.CRITICAL_HIT, getPlayer(), getSkillLevel(), activationChance)) {
return 0;
}
@ -94,8 +97,13 @@ public class AxesManager extends SkillManager {
int durabilityDamage = 1 + (getSkillLevel() / Axes.impactIncreaseLevel);
for (ItemStack armor : target.getEquipment().getArmorContents()) {
if (ItemUtils.isArmor(armor) && Axes.impactChance > Misc.getRandom().nextInt(getActivationChance())) {
SkillUtils.handleDurabilityChange(armor, durabilityDamage, Axes.impactMaxDurabilityModifier);
if (ItemUtils.isArmor(armor)) {
double chance = Axes.impactChance / activationChance;
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbilityType.ARMOR_IMPACT, chance);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
SkillUtils.handleDurabilityChange(armor, durabilityDamage, Axes.impactMaxDurabilityModifier);
}
}
}
}
@ -106,7 +114,10 @@ public class AxesManager extends SkillManager {
* @param target The {@link LivingEntity} being affected by the ability
*/
public double greaterImpact(LivingEntity target) {
if (!(Axes.greaterImpactChance > Misc.getRandom().nextInt(getActivationChance()))) {
double chance = Axes.greaterImpactChance / activationChance;
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbilityType.GREATER_IMPACT, chance);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if ((event.getChance() * activationChance) <= Misc.getRandom().nextInt(activationChance)) {
return 0;
}

View File

@ -7,6 +7,7 @@ import org.bukkit.block.BlockState;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.skills.SkillManager;
@ -27,7 +28,7 @@ public class ExcavationManager extends SkillManager {
public void excavationBlockCheck(BlockState blockState) {
int xp = Excavation.getBlockXP(blockState);
if (Permissions.excavationTreasureHunter(getPlayer())) {
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.EXCAVATION_TREASURE_HUNTER)) {
List<ExcavationTreasure> treasures = Excavation.getTreasures(blockState);
if (!treasures.isEmpty()) {
@ -35,7 +36,7 @@ public class ExcavationManager extends SkillManager {
Location location = blockState.getLocation();
for (ExcavationTreasure treasure : treasures) {
if (skillLevel >= treasure.getDropLevel() && SkillUtils.treasureDropSuccessful(treasure.getDropChance(), activationChance)) {
if (skillLevel >= treasure.getDropLevel() && SkillUtils.treasureDropSuccessful(getPlayer(), treasure.getDropChance(), activationChance)) {
xp += treasure.getXp();
Misc.dropItem(location, treasure.getDrop());
}

View File

@ -41,6 +41,7 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
@ -48,6 +49,7 @@ import com.gmail.nossr50.datatypes.treasure.Rarity;
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.skills.KrakenAttackTask;
import com.gmail.nossr50.skills.SkillManager;
@ -74,11 +76,11 @@ public class FishingManager extends SkillManager {
}
public boolean canShake(Entity target) {
return target instanceof LivingEntity && getSkillLevel() >= Tier.ONE.getLevel() && Permissions.shake(getPlayer());
return target instanceof LivingEntity && getSkillLevel() >= Tier.ONE.getLevel() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.SHAKE);
}
public boolean canMasterAngler() {
return getSkillLevel() >= AdvancedConfig.getInstance().getMasterAnglerUnlockLevel() && Permissions.masterAngler(getPlayer());
return getSkillLevel() >= AdvancedConfig.getInstance().getMasterAnglerUnlockLevel() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.MASTER_ANGLER);
}
public boolean unleashTheKraken() {
@ -205,7 +207,7 @@ public class FishingManager extends SkillManager {
Player player = getPlayer();
if (!Permissions.iceFishing(player)) {
if (!Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.ICE_FISHING)) {
return false;
}
@ -306,7 +308,7 @@ public class FishingManager extends SkillManager {
Player player = getPlayer();
FishingTreasure treasure = null;
if (Config.getInstance().getFishingDropsEnabled() && Permissions.fishingTreasureHunter(player)) {
if (Config.getInstance().getFishingDropsEnabled() && Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FISHING_TREASURE_HUNTER)) {
treasure = getFishingTreasure();
this.fishingCatch = null;
}
@ -317,7 +319,7 @@ public class FishingManager extends SkillManager {
ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay?
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
if (Permissions.magicHunter(player) && ItemUtils.isEnchantable(treasureDrop)) {
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.MAGIC_HUNTER) && ItemUtils.isEnchantable(treasureDrop)) {
enchants = handleMagicHunter(treasureDrop);
}
@ -375,7 +377,9 @@ public class FishingManager extends SkillManager {
public void shakeCheck(LivingEntity target) {
fishingTries--; // Because autoclicking to shake is OK.
if (getShakeProbability() > Misc.getRandom().nextInt(getActivationChance())) {
SecondaryAbilityWeightedActivationCheckEvent activationEvent = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbilityType.SHAKE, getShakeProbability() / activationChance);
mcMMO.p.getServer().getPluginManager().callEvent(activationEvent);
if ((activationEvent.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
List<ShakeTreasure> possibleDrops = Fishing.findPossibleDrops(target);
if (possibleDrops == null || possibleDrops.isEmpty()) {
@ -425,11 +429,11 @@ public class FishingManager extends SkillManager {
break;
}
McMMOPlayerShakeEvent event = new McMMOPlayerShakeEvent(getPlayer(), drop);
McMMOPlayerShakeEvent shakeEvent = new McMMOPlayerShakeEvent(getPlayer(), drop);
drop = event.getDrop();
drop = shakeEvent.getDrop();
if (event.isCancelled() || drop == null) {
if (shakeEvent.isCancelled() || drop == null) {
return;
}

View File

@ -17,18 +17,6 @@ public class Herbalism {
public static int greenThumbStageChangeLevel = AdvancedConfig.getInstance().getGreenThumbStageChange();
public static int greenThumbStageMaxLevel = greenThumbStageChangeLevel * 4;
public static int greenThumbMaxLevel = AdvancedConfig.getInstance().getGreenThumbMaxLevel();
public static double greenThumbMaxChance = AdvancedConfig.getInstance().getGreenThumbChanceMax();
public static int doubleDropsMaxLevel = AdvancedConfig.getInstance().getHerbalismDoubleDropsMaxLevel();
public static double doubleDropsMaxChance = AdvancedConfig.getInstance().getHerbalismDoubleDropsChanceMax();
public static int hylianLuckMaxLevel = AdvancedConfig.getInstance().getHylianLuckMaxLevel();
public static double hylianLuckMaxChance = AdvancedConfig.getInstance().getHylianLuckChanceMax();
public static int shroomThumbMaxLevel = AdvancedConfig.getInstance().getShroomThumbMaxLevel();
public static double shroomThumbMaxChance = AdvancedConfig.getInstance().getShroomThumbChanceMax();
/**
* Convert blocks affected by the Green Thumb & Green Terra abilities.
*

View File

@ -23,6 +23,7 @@ import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
@ -56,11 +57,11 @@ public class HerbalismManager extends SkillManager {
Player player = getPlayer();
Material itemType = player.getItemInHand().getType();
return (itemType == Material.RED_MUSHROOM || itemType == Material.BROWN_MUSHROOM) && BlockUtils.canMakeShroomy(blockState) && Permissions.shroomThumb(player);
return (itemType == Material.RED_MUSHROOM || itemType == Material.BROWN_MUSHROOM) && BlockUtils.canMakeShroomy(blockState) && Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.SHROOM_THUMB);
}
public boolean canUseHylianLuck() {
return Permissions.hylianLuck(getPlayer());
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.HYLIAN_LUCK);
}
public boolean canGreenTerraBlock(BlockState blockState) {
@ -140,7 +141,7 @@ public class HerbalismManager extends SkillManager {
CustomBlock customBlock = ModUtils.getCustomBlock(blockState);
xp = customBlock.getXpGain();
if (Permissions.doubleDrops(player, skill) && customBlock.isDoubleDropEnabled()) {
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.HERBALISM_DOUBLE_DROPS) && customBlock.isDoubleDropEnabled()) {
drops = blockState.getBlock().getDrops();
}
}
@ -151,7 +152,7 @@ public class HerbalismManager extends SkillManager {
xp = ExperienceConfig.getInstance().getXp(skill, material);
if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.doubleDrops(player, skill)) {
if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.HERBALISM_DOUBLE_DROPS)) {
drops = blockState.getBlock().getDrops();
}
@ -168,7 +169,7 @@ public class HerbalismManager extends SkillManager {
}
for (int i = greenTerra ? 2 : 1; i != 0; i--) {
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.doubleDropsMaxChance, Herbalism.doubleDropsMaxLevel)) {
if (SkillUtils.activationSuccessful(SecondaryAbilityType.HERBALISM_DOUBLE_DROPS, getPlayer(), getSkillLevel(), activationChance)) {
for (ItemStack item : drops) {
Misc.dropItems(blockState.getLocation(), item, amount);
}
@ -183,7 +184,7 @@ public class HerbalismManager extends SkillManager {
* @return true if the ability was successful, false otherwise
*/
public boolean processGreenThumbBlocks(BlockState blockState) {
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.greenThumbMaxChance, Herbalism.greenThumbMaxLevel)) {
if (!SkillUtils.activationSuccessful(SecondaryAbilityType.GREEN_THUMB_BLOCK, getPlayer(), getSkillLevel(), activationChance)) {
getPlayer().sendMessage(LocaleLoader.getString("Herbalism.Ability.GTh.Fail"));
return false;
}
@ -198,7 +199,7 @@ public class HerbalismManager extends SkillManager {
* @return true if the ability was successful, false otherwise
*/
public boolean processHylianLuck(BlockState blockState) {
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.hylianLuckMaxChance, Herbalism.hylianLuckMaxLevel)) {
if (!SkillUtils.activationSuccessful(SecondaryAbilityType.HYLIAN_LUCK, getPlayer(), getSkillLevel(), activationChance)) {
return false;
}
@ -266,7 +267,7 @@ public class HerbalismManager extends SkillManager {
playerInventory.removeItem(new ItemStack(Material.RED_MUSHROOM));
player.updateInventory();
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.shroomThumbMaxChance, Herbalism.shroomThumbMaxLevel)) {
if (!SkillUtils.activationSuccessful(SecondaryAbilityType.SHROOM_THUMB, getPlayer(), getSkillLevel(), activationChance)) {
player.sendMessage(LocaleLoader.getString("Herbalism.Ability.ShroomThumb.Fail"));
return false;
}
@ -310,7 +311,7 @@ public class HerbalismManager extends SkillManager {
return;
}
if (!greenTerra && !SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Herbalism.greenThumbMaxChance, Herbalism.greenThumbMaxLevel)) {
if (!greenTerra && !SkillUtils.activationSuccessful(SecondaryAbilityType.GREEN_THUMB_PLANT, getPlayer(), getSkillLevel(), activationChance)) {
return;
}

View File

@ -4,7 +4,6 @@ import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.SkillType;
@ -12,8 +11,6 @@ import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ModUtils;
public class Mining {
public static int doubleDropsMaxLevel = AdvancedConfig.getInstance().getMiningDoubleDropMaxLevel();
public static double doubleDropsMaxChance = AdvancedConfig.getInstance().getMiningDoubleDropChance();
/**
* Calculate XP gain for Mining.

View File

@ -15,6 +15,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
@ -60,7 +61,7 @@ public class MiningManager extends SkillManager {
applyXpGain(Mining.getBlockXp(blockState));
if (!Permissions.doubleDrops(player, skill)) {
if (!Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.MINING_DOUBLE_DROPS)) {
return;
}
@ -77,7 +78,7 @@ public class MiningManager extends SkillManager {
boolean silkTouch = player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH);
for (int i = mcMMOPlayer.getAbilityMode(skill.getAbility()) ? 2 : 1; i != 0; i--) {
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Mining.doubleDropsMaxChance, Mining.doubleDropsMaxLevel)) {
if (SkillUtils.activationSuccessful(SecondaryAbilityType.MINING_DOUBLE_DROPS, getPlayer(), getSkillLevel(), activationChance)) {
if (silkTouch) {
Mining.handleSilkTouchDrops(blockState);
}

View File

@ -19,9 +19,6 @@ public class Repair {
public static int repairMasteryMaxBonusLevel = AdvancedConfig.getInstance().getRepairMasteryMaxLevel();
public static double repairMasteryMaxBonus = AdvancedConfig.getInstance().getRepairMasteryMaxBonus();
public static int superRepairMaxBonusLevel = AdvancedConfig.getInstance().getSuperRepairMaxLevel();
public static double superRepairMaxChance = AdvancedConfig.getInstance().getSuperRepairChanceMax();
public static int salvageUnlockLevel = AdvancedConfig.getInstance().getSalvageUnlockLevel();
public static Material salvageAnvilMaterial = Config.getInstance().getSalvageAnvilMaterial();

View File

@ -16,6 +16,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillManager;
@ -273,12 +274,12 @@ public class RepairManager extends SkillManager {
private short repairCalculate(short durability, int repairAmount) {
Player player = getPlayer();
if (Permissions.repairMastery(player)) {
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.REPAIR_MASTERY)) {
double bonus = repairAmount * Math.min((((Repair.repairMasteryMaxBonus / Repair.repairMasteryMaxBonusLevel) * getSkillLevel()) / 100.0D), Repair.repairMasteryMaxBonus / 100.0D);
repairAmount += bonus;
}
if (Permissions.superRepair(player) && checkPlayerProcRepair()) {
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.SUPER_REPAIR) && checkPlayerProcRepair()) {
repairAmount *= 2.0D;
}
@ -295,7 +296,7 @@ public class RepairManager extends SkillManager {
* @return true if bonus granted, false otherwise
*/
private boolean checkPlayerProcRepair() {
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Repair.superRepairMaxChance, Repair.superRepairMaxBonusLevel)) {
if (SkillUtils.activationSuccessful(SecondaryAbilityType.SUPER_REPAIR, getPlayer(), getSkillLevel(), activationChance)) {
getPlayer().sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
return true;
}
@ -322,7 +323,7 @@ public class RepairManager extends SkillManager {
return;
}
if (getArcaneForgingRank() == 0 || !Permissions.arcaneForging(player)) {
if (getArcaneForgingRank() == 0 || !Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.ARCANE_FORGING)) {
for (Enchantment enchant : enchants.keySet()) {
item.removeEnchantment(enchant);
}

View File

@ -43,9 +43,6 @@ public class Smelting {
public static int burnModifierMaxLevel = AdvancedConfig.getInstance().getBurnModifierMaxLevel();
public static double burnTimeMultiplier = AdvancedConfig.getInstance().getBurnTimeMultiplier();
public static int secondSmeltMaxLevel = AdvancedConfig.getInstance().getSecondSmeltMaxLevel();
public static double secondSmeltMaxChance = AdvancedConfig.getInstance().getSecondSmeltMaxChance();
public static int fluxMiningUnlockLevel = AdvancedConfig.getInstance().getFluxMiningUnlockLevel();
public static double fluxMiningChance = AdvancedConfig.getInstance().getFluxMiningChance();

View File

@ -8,10 +8,11 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.skills.mining.Mining;
import com.gmail.nossr50.skills.smelting.Smelting.Tier;
import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.Misc;
@ -24,11 +25,11 @@ public class SmeltingManager extends SkillManager {
}
public boolean canUseFluxMining(BlockState blockState) {
return getSkillLevel() >= Smelting.fluxMiningUnlockLevel && BlockUtils.affectedByFluxMining(blockState) && Permissions.fluxMining(getPlayer()) && !mcMMO.getPlaceStore().isTrue(blockState);
return getSkillLevel() >= Smelting.fluxMiningUnlockLevel && BlockUtils.affectedByFluxMining(blockState) && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.FLUX_MINING) && !mcMMO.getPlaceStore().isTrue(blockState);
}
public boolean isDoubleDropSuccessful() {
return Permissions.doubleDrops(getPlayer(), skill) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Mining.doubleDropsMaxChance, Mining.doubleDropsMaxLevel);
public boolean isSecondSmeltSuccessful() {
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.SECOND_SMELT) && SkillUtils.activationSuccessful(SecondaryAbilityType.SECOND_SMELT, getPlayer(), getSkillLevel(), activationChance);
}
/**
@ -40,7 +41,9 @@ public class SmeltingManager extends SkillManager {
public boolean processFluxMining(BlockState blockState) {
Player player = getPlayer();
if (Smelting.fluxMiningChance > Misc.getRandom().nextInt(getActivationChance())) {
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbilityType.FLUX_MINING, Smelting.fluxMiningChance / activationChance);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
ItemStack item = null;
switch (blockState.getType()) {
@ -60,7 +63,7 @@ public class SmeltingManager extends SkillManager {
return false;
}
Misc.dropItems(blockState.getLocation(), item, isDoubleDropSuccessful() ? 2 : 1);
Misc.dropItems(blockState.getLocation(), item, isSecondSmeltSuccessful() ? 2 : 1);
blockState.setType(Material.AIR);
player.sendMessage(LocaleLoader.getString("Smelting.FluxMining.Success"));
@ -82,11 +85,9 @@ public class SmeltingManager extends SkillManager {
}
public ItemStack smeltProcessing(ItemStack smelting, ItemStack result) {
Player player = getPlayer();
applyXpGain(Smelting.getResourceXp(smelting));
if (Permissions.doubleDrops(player, skill) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Smelting.secondSmeltMaxChance, Smelting.secondSmeltMaxLevel)) {
if (isSecondSmeltSuccessful()) {
ItemStack newResult = result.clone();
newResult.setAmount(result.getAmount() + 1);

View File

@ -3,15 +3,11 @@ package com.gmail.nossr50.skills.swords;
import com.gmail.nossr50.config.AdvancedConfig;
public class Swords {
public static int bleedMaxBonusLevel = AdvancedConfig.getInstance().getBleedMaxBonusLevel();
public static int bleedMaxTicks = AdvancedConfig.getInstance().getBleedMaxTicks();
public static int bleedBaseTicks = AdvancedConfig.getInstance().getBleedBaseTicks();
public static double bleedMaxChance = AdvancedConfig.getInstance().getBleedChanceMax();
public static boolean counterAttackRequiresBlock = AdvancedConfig.getInstance().getCounterRequiresBlock();
public static int counterAttackMaxBonusLevel = AdvancedConfig.getInstance().getCounterMaxBonusLevel();
public static double counterAttackModifier = AdvancedConfig.getInstance().getCounterModifier();
public static double counterAttackMaxChance = AdvancedConfig.getInstance().getCounterChanceMax();
public static double serratedStrikesModifier = AdvancedConfig.getInstance().getSerratedStrikesModifier();
public static int serratedStrikesBleedTicks = AdvancedConfig.getInstance().getSerratedStrikesTicks();

View File

@ -4,8 +4,10 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.locale.LocaleLoader;
@ -26,11 +28,11 @@ public class SwordsManager extends SkillManager {
}
public boolean canUseBleed() {
return Permissions.bleed(getPlayer());
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.BLEED);
}
public boolean canUseCounterAttack(Entity target) {
return target instanceof LivingEntity && Permissions.counterAttack(getPlayer());
return target instanceof LivingEntity && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.COUNTER);
}
public boolean canUseSerratedStrike() {
@ -43,9 +45,9 @@ public class SwordsManager extends SkillManager {
* @param target The defending entity
*/
public void bleedCheck(LivingEntity target) {
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Swords.bleedMaxChance, Swords.bleedMaxBonusLevel)) {
if (SkillUtils.activationSuccessful(SecondaryAbilityType.BLEED, getPlayer(), getSkillLevel(), activationChance)) {
if (getSkillLevel() >= Swords.bleedMaxBonusLevel) {
if (getSkillLevel() >= AdvancedConfig.getInstance().getMaxBonusLevel(SecondaryAbilityType.BLEED)) {
BleedTimerTask.add(target, Swords.bleedMaxTicks);
}
else {
@ -77,7 +79,7 @@ public class SwordsManager extends SkillManager {
return;
}
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Swords.counterAttackMaxChance, Swords.counterAttackMaxBonusLevel)) {
if (SkillUtils.activationSuccessful(SecondaryAbilityType.COUNTER, getPlayer(), getSkillLevel(), activationChance)) {
CombatUtils.dealDamage(attacker, damage / Swords.counterAttackModifier);
getPlayer().sendMessage(LocaleLoader.getString("Swords.Combat.Countered"));

View File

@ -19,9 +19,7 @@ public class Taming {
public static double fastFoodServiceActivationChance = AdvancedConfig.getInstance().getFastFoodChance();
public static int goreBleedTicks = AdvancedConfig.getInstance().getGoreBleedTicks();
public static int goreMaxBonusLevel = AdvancedConfig.getInstance().getGoreMaxBonusLevel();
public static double goreModifier = AdvancedConfig.getInstance().getGoreModifier();
public static double goreMaxChance = AdvancedConfig.getInstance().getGoreChanceMax();
public static int sharpenedClawsUnlockLevel = AdvancedConfig.getInstance().getSharpenedClawsUnlock();
public static double sharpenedClawsBonusDamage = AdvancedConfig.getInstance().getSharpenedClawsBonus();

View File

@ -14,7 +14,9 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
import com.gmail.nossr50.skills.SkillManager;
@ -30,35 +32,35 @@ public class TamingManager extends SkillManager {
}
public boolean canUseThickFur() {
return getSkillLevel() >= Taming.thickFurUnlockLevel && Permissions.thickFur(getPlayer());
return getSkillLevel() >= Taming.thickFurUnlockLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.THICK_FUR);
}
public boolean canUseEnvironmentallyAware() {
return getSkillLevel() >= Taming.environmentallyAwareUnlockLevel && Permissions.environmentallyAware(getPlayer());
return getSkillLevel() >= Taming.environmentallyAwareUnlockLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.ENVIROMENTALLY_AWARE);
}
public boolean canUseShockProof() {
return getSkillLevel() >= Taming.shockProofUnlockLevel && Permissions.shockProof(getPlayer());
return getSkillLevel() >= Taming.shockProofUnlockLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.SHOCK_PROOF);
}
public boolean canUseHolyHound() {
return getSkillLevel() >= Taming.holyHoundUnlockLevel && Permissions.holyHound(getPlayer());
return getSkillLevel() >= Taming.holyHoundUnlockLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.HOLY_HOUND);
}
public boolean canUseFastFoodService() {
return getSkillLevel() >= Taming.fastFoodServiceUnlockLevel && Permissions.fastFoodService(getPlayer());
return getSkillLevel() >= Taming.fastFoodServiceUnlockLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.FAST_FOOD);
}
public boolean canUseSharpenedClaws() {
return getSkillLevel() >= Taming.sharpenedClawsUnlockLevel && Permissions.sharpenedClaws(getPlayer());
return getSkillLevel() >= Taming.sharpenedClawsUnlockLevel && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.SHARPENED_CLAWS);
}
public boolean canUseGore() {
return Permissions.gore(getPlayer());
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.GORE);
}
public boolean canUseBeastLore() {
return Permissions.beastLore(getPlayer());
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.BEAST_LORE);
}
/**
@ -92,7 +94,10 @@ public class TamingManager extends SkillManager {
* @param damage The damage being absorbed by the wolf
*/
public void fastFoodService(Wolf wolf, double damage) {
if (Taming.fastFoodServiceActivationChance > Misc.getRandom().nextInt(getActivationChance())) {
double chance = Taming.fastFoodServiceActivationChance / activationChance;
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbilityType.FAST_FOOD, chance);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
double health = wolf.getHealth();
double maxHealth = wolf.getMaxHealth();
@ -112,7 +117,7 @@ public class TamingManager extends SkillManager {
* @param wolf The wolf using the ability
*/
public double gore(LivingEntity target, double damage, Wolf wolf) {
if (!SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Taming.goreMaxChance, Taming.goreMaxBonusLevel)) {
if (!SkillUtils.activationSuccessful(SecondaryAbilityType.GORE, getPlayer(), getSkillLevel(), activationChance)) {
return 0;
}

View File

@ -14,15 +14,6 @@ public class Unarmed {
public static double ironArmMaxBonusDamage = AdvancedConfig.getInstance().getIronArmMaxBonus();
public static int ironArmIncreaseLevel = AdvancedConfig.getInstance().getIronArmIncreaseLevel();
public static int disarmMaxBonusLevel = AdvancedConfig.getInstance().getDisarmMaxBonusLevel();
public static double disarmMaxChance = AdvancedConfig.getInstance().getDisarmChanceMax();
public static int deflectMaxBonusLevel = AdvancedConfig.getInstance().getDeflectMaxBonusLevel();
public static double deflectMaxChance = AdvancedConfig.getInstance().getDeflectChanceMax();
public static int ironGripMaxBonusLevel = AdvancedConfig.getInstance().getIronGripMaxBonusLevel();
public static double ironGripMaxChance = AdvancedConfig.getInstance().getIronGripChanceMax();
public static boolean blockCrackerSmoothBrick = Config.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
public static double berserkDamageModifier = 1.5;

View File

@ -10,6 +10,7 @@ import org.bukkit.material.SmoothBrick;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.locale.LocaleLoader;
@ -30,7 +31,7 @@ public class UnarmedManager extends SkillManager {
}
public boolean canUseIronArm() {
return Permissions.bonusDamage(getPlayer(), skill);
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.IRON_ARM);
}
public boolean canUseBerserk() {
@ -38,17 +39,17 @@ public class UnarmedManager extends SkillManager {
}
public boolean canDisarm(LivingEntity target) {
return target instanceof Player && ((Player) target).getItemInHand().getType() != Material.AIR && Permissions.disarm(getPlayer());
return target instanceof Player && ((Player) target).getItemInHand().getType() != Material.AIR && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.DISARM);
}
public boolean canDeflect() {
Player player = getPlayer();
return player.getItemInHand().getType() == Material.AIR && Permissions.arrowDeflect(player);
return player.getItemInHand().getType() == Material.AIR && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.DEFLECT);
}
public boolean canUseBlockCracker() {
return Permissions.blockCracker(getPlayer());
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.BLOCK_CRACKER);
}
public boolean blockCrackerCheck(BlockState blockState) {
@ -81,7 +82,7 @@ public class UnarmedManager extends SkillManager {
* @param defender The defending player
*/
public void disarmCheck(Player defender) {
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Unarmed.disarmMaxChance, Unarmed.disarmMaxBonusLevel) && !hasIronGrip(defender)) {
if (SkillUtils.activationSuccessful(SecondaryAbilityType.DISARM, getPlayer(), getSkillLevel(), activationChance) && !hasIronGrip(defender)) {
if (EventUtils.callDisarmEvent(defender).isCancelled()) {
return;
}
@ -97,7 +98,7 @@ public class UnarmedManager extends SkillManager {
* Check for arrow deflection.
*/
public boolean deflectCheck() {
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Unarmed.deflectMaxChance, Unarmed.deflectMaxBonusLevel)) {
if (SkillUtils.activationSuccessful(SecondaryAbilityType.DEFLECT, getPlayer(), getSkillLevel(), activationChance)) {
getPlayer().sendMessage(LocaleLoader.getString("Combat.ArrowDeflect"));
return true;
}
@ -135,7 +136,7 @@ public class UnarmedManager extends SkillManager {
* @return true if the defender was not disarmed, false otherwise
*/
private boolean hasIronGrip(Player defender) {
if (!Misc.isNPCEntity(defender) && Permissions.ironGrip(defender) && SkillUtils.activationSuccessful(defender, skill, Unarmed.ironGripMaxChance, Unarmed.ironGripMaxBonusLevel)) {
if (!Misc.isNPCEntity(defender) && Permissions.secondaryAbilityEnabled(defender, SecondaryAbilityType.IRON_GRIP) && SkillUtils.activationSuccessful(SecondaryAbilityType.IRON_GRIP, defender, skill)) {
defender.sendMessage(LocaleLoader.getString("Unarmed.Ability.IronGrip.Defender"));
getPlayer().sendMessage(LocaleLoader.getString("Unarmed.Ability.IronGrip.Attacker"));

View File

@ -20,9 +20,6 @@ import com.gmail.nossr50.util.ModUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
public final class Woodcutting {
public static int doubleDropsMaxLevel = AdvancedConfig.getInstance().getWoodcuttingDoubleDropMaxLevel();
public static double doubleDropsMaxChance = AdvancedConfig.getInstance().getWoodcuttingDoubleDropChance();
public static int leafBlowerUnlockLevel = AdvancedConfig.getInstance().getLeafBlowUnlockLevel();
public static int treeFellerThreshold = Config.getInstance().getTreeFellerThreshold();

View File

@ -14,6 +14,7 @@ import org.bukkit.material.Tree;
import com.gmail.nossr50.datatypes.mods.CustomBlock;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillManager;
@ -32,7 +33,7 @@ public class WoodcuttingManager extends SkillManager {
}
public boolean canUseLeafBlower(ItemStack heldItem) {
return getSkillLevel() >= Woodcutting.leafBlowerUnlockLevel && ItemUtils.isAxe(heldItem);
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.LEAF_BLOWER) && getSkillLevel() >= Woodcutting.leafBlowerUnlockLevel && ItemUtils.isAxe(heldItem);
}
public boolean canUseTreeFeller(ItemStack heldItem) {
@ -40,7 +41,7 @@ public class WoodcuttingManager extends SkillManager {
}
protected boolean canGetDoubleDrops() {
return Permissions.doubleDrops(getPlayer(), skill) && SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Woodcutting.doubleDropsMaxChance, Woodcutting.doubleDropsMaxLevel);
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.WOODCUTTING_DOUBLE_DROPS) && SkillUtils.activationSuccessful(SecondaryAbilityType.WOODCUTTING_DOUBLE_DROPS, getPlayer(), getSkillLevel(), activationChance);
}
/**