Missed a refactor :P Also, javadoc event

This commit is contained in:
t00thpick1 2013-11-22 12:48:53 -05:00
parent 870987bba7
commit c0dee19cb0
38 changed files with 265 additions and 249 deletions

View File

@ -5,7 +5,7 @@ import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -30,21 +30,21 @@ public class AcrobaticsCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue, boolean isLucky) { protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
// DODGE // DODGE
if (canDodge) { if (canDodge) {
String[] dodgeStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.DODGE, isLucky); String[] dodgeStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DODGE, isLucky);
dodgeChance = dodgeStrings[0]; dodgeChance = dodgeStrings[0];
dodgeChanceLucky = dodgeStrings[1]; dodgeChanceLucky = dodgeStrings[1];
} }
// ROLL // ROLL
if (canRoll) { if (canRoll) {
String[] rollStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.ROLL, isLucky); String[] rollStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.ROLL, isLucky);
rollChance = rollStrings[0]; rollChance = rollStrings[0];
rollChanceLucky = rollStrings[1]; rollChanceLucky = rollStrings[1];
} }
// GRACEFUL ROLL // GRACEFUL ROLL
if (canGracefulRoll) { if (canGracefulRoll) {
String[] gracefulRollStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.GRACEFUL_ROLL, isLucky); String[] gracefulRollStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GRACEFUL_ROLL, isLucky);
gracefulRollChance = gracefulRollStrings[0]; gracefulRollChance = gracefulRollStrings[0];
gracefulRollChanceLucky = gracefulRollStrings[1]; gracefulRollChanceLucky = gracefulRollStrings[1];
} }
@ -52,9 +52,9 @@ public class AcrobaticsCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canDodge = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.DODGE); canDodge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DODGE);
canRoll = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.ROLL); canRoll = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ROLL);
canGracefulRoll = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.GRACEFUL_ROLL); canGracefulRoll = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GRACEFUL_ROLL);
} }
@Override @Override

View File

@ -5,7 +5,7 @@ import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.archery.Archery; import com.gmail.nossr50.skills.archery.Archery;
@ -36,14 +36,14 @@ public class ArcheryCommand extends SkillCommand {
// DAZE // DAZE
if (canDaze) { if (canDaze) {
String[] dazeStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.DAZE, isLucky); String[] dazeStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DAZE, isLucky);
dazeChance = dazeStrings[0]; dazeChance = dazeStrings[0];
dazeChanceLucky = dazeStrings[1]; dazeChanceLucky = dazeStrings[1];
} }
// RETRIEVE // RETRIEVE
if (canRetrieve) { if (canRetrieve) {
String[] retrieveStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.RETRIEVE, isLucky); String[] retrieveStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.RETRIEVE, isLucky);
retrieveChance = retrieveStrings[0]; retrieveChance = retrieveStrings[0];
retrieveChanceLucky = retrieveStrings[1]; retrieveChanceLucky = retrieveStrings[1];
} }
@ -51,9 +51,9 @@ public class ArcheryCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canSkillShot = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.SKILL_SHOT); canSkillShot = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SKILL_SHOT);
canDaze = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.DAZE); canDaze = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DAZE);
canRetrieve = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.RETRIEVE); canRetrieve = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.RETRIEVE);
} }
@Override @Override

View File

@ -5,7 +5,7 @@ import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.axes.Axes; import com.gmail.nossr50.skills.axes.Axes;
@ -45,7 +45,7 @@ public class AxesCommand extends SkillCommand {
// CRITICAL HIT // CRITICAL HIT
if (canCritical) { if (canCritical) {
String[] criticalHitStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.CRITICAL_HIT, isLucky); String[] criticalHitStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.CRITICAL_HIT, isLucky);
critChance = criticalHitStrings[0]; critChance = criticalHitStrings[0];
critChanceLucky = criticalHitStrings[1]; critChanceLucky = criticalHitStrings[1];
} }
@ -59,10 +59,10 @@ public class AxesCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canSkullSplitter = Permissions.skullSplitter(player); canSkullSplitter = Permissions.skullSplitter(player);
canCritical = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.CRITICAL_HIT); canCritical = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CRITICAL_HIT);
canAxeMastery = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.AXE_MASTERY); canAxeMastery = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.AXE_MASTERY);
canImpact = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.ARMOR_IMPACT); canImpact = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARMOR_IMPACT);
canGreaterImpact = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.GREATER_IMPACT); canGreaterImpact = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GREATER_IMPACT);
} }
@Override @Override

View File

@ -5,7 +5,7 @@ import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -34,7 +34,7 @@ public class ExcavationCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canGigaDrill = Permissions.gigaDrillBreaker(player); canGigaDrill = Permissions.gigaDrillBreaker(player);
canTreasureHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.EXCAVATION_TREASURE_HUNTER); canTreasureHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.EXCAVATION_TREASURE_HUNTER);
} }
@Override @Override

View File

@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig; import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.treasure.Rarity; import com.gmail.nossr50.datatypes.treasure.Rarity;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
@ -115,12 +115,12 @@ public class FishingCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canTreasureHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FISHING_TREASURE_HUNTER); canTreasureHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHING_TREASURE_HUNTER);
canMagicHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.MAGIC_HUNTER); canMagicHunt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MAGIC_HUNTER);
canShake = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.SHAKE); canShake = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHAKE);
canFishermansDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FISHERMANS_DIET); canFishermansDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET);
canMasterAngler = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.MASTER_ANGLER); canMasterAngler = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MASTER_ANGLER);
canIceFish = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.ICE_FISHING); canIceFish = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ICE_FISHING);
} }
@Override @Override

View File

@ -6,7 +6,7 @@ import java.util.List;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.herbalism.Herbalism; import com.gmail.nossr50.skills.herbalism.Herbalism;
@ -56,28 +56,28 @@ public class HerbalismCommand extends SkillCommand {
if (canGreenThumbBlocks || canGreenThumbPlants) { if (canGreenThumbBlocks || canGreenThumbPlants) {
greenThumbStage = calculateRank(skillValue, Herbalism.greenThumbStageMaxLevel, Herbalism.greenThumbStageChangeLevel); greenThumbStage = calculateRank(skillValue, Herbalism.greenThumbStageMaxLevel, Herbalism.greenThumbStageChangeLevel);
String[] greenThumbStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.GREEN_THUMB_PLANT, isLucky); String[] greenThumbStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GREEN_THUMB_PLANT, isLucky);
greenThumbChance = greenThumbStrings[0]; greenThumbChance = greenThumbStrings[0];
greenThumbChanceLucky = greenThumbStrings[1]; greenThumbChanceLucky = greenThumbStrings[1];
} }
// DOUBLE DROPS // DOUBLE DROPS
if (canDoubleDrop) { if (canDoubleDrop) {
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.HERBALISM_DOUBLE_DROPS, isLucky); String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.HERBALISM_DOUBLE_DROPS, isLucky);
doubleDropChance = doubleDropStrings[0]; doubleDropChance = doubleDropStrings[0];
doubleDropChanceLucky = doubleDropStrings[1]; doubleDropChanceLucky = doubleDropStrings[1];
} }
// HYLIAN LUCK // HYLIAN LUCK
if (hasHylianLuck) { if (hasHylianLuck) {
String[] hylianLuckStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.HYLIAN_LUCK, isLucky); String[] hylianLuckStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.HYLIAN_LUCK, isLucky);
hylianLuckChance = hylianLuckStrings[0]; hylianLuckChance = hylianLuckStrings[0];
hylianLuckChanceLucky = hylianLuckStrings[1]; hylianLuckChanceLucky = hylianLuckStrings[1];
} }
// SHROOM THUMB // SHROOM THUMB
if (canShroomThumb) { if (canShroomThumb) {
String[] shroomThumbStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.SHROOM_THUMB, isLucky); String[] shroomThumbStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SHROOM_THUMB, isLucky);
shroomThumbChance = shroomThumbStrings[0]; shroomThumbChance = shroomThumbStrings[0];
shroomThumbChanceLucky = shroomThumbStrings[1]; shroomThumbChanceLucky = shroomThumbStrings[1];
} }
@ -85,13 +85,13 @@ public class HerbalismCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
hasHylianLuck = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.HYLIAN_LUCK); hasHylianLuck = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HYLIAN_LUCK);
canGreenTerra = Permissions.greenTerra(player); canGreenTerra = Permissions.greenTerra(player);
canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.CROPS) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.NETHER_WARTS) || Permissions.greenThumbPlant(player, Material.COCOA); canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.CROPS) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.NETHER_WARTS) || Permissions.greenThumbPlant(player, Material.COCOA);
canGreenThumbBlocks = Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLE_WALL) || Permissions.greenThumbBlock(player, Material.SMOOTH_BRICK); canGreenThumbBlocks = Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLE_WALL) || Permissions.greenThumbBlock(player, Material.SMOOTH_BRICK);
canFarmersDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FARMERS_DIET); canFarmersDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET);
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled(); canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
canShroomThumb = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.SHROOM_THUMB); canShroomThumb = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHROOM_THUMB);
} }
@Override @Override

View File

@ -6,7 +6,7 @@ import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.mining.BlastMining.Tier; import com.gmail.nossr50.skills.mining.BlastMining.Tier;
@ -48,7 +48,7 @@ public class MiningCommand extends SkillCommand {
// DOUBLE DROPS // DOUBLE DROPS
if (canDoubleDrop) { if (canDoubleDrop) {
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.MINING_DOUBLE_DROPS, isLucky); String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.MINING_DOUBLE_DROPS, isLucky);
doubleDropChance = doubleDropStrings[0]; doubleDropChance = doubleDropStrings[0];
doubleDropChanceLucky = doubleDropStrings[1]; doubleDropChanceLucky = doubleDropStrings[1];
} }
@ -71,7 +71,7 @@ public class MiningCommand extends SkillCommand {
canBiggerBombs = Permissions.biggerBombs(player); canBiggerBombs = Permissions.biggerBombs(player);
canBlast = Permissions.remoteDetonation(player); canBlast = Permissions.remoteDetonation(player);
canDemoExpert = Permissions.demolitionsExpertise(player); canDemoExpert = Permissions.demolitionsExpertise(player);
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.MINING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled(); canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MINING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
canSuperBreaker = Permissions.superBreaker(player); canSuperBreaker = Permissions.superBreaker(player);
} }

View File

@ -7,7 +7,7 @@ import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.repair.ArcaneForging; import com.gmail.nossr50.skills.repair.ArcaneForging;
@ -66,7 +66,7 @@ public class RepairCommand extends SkillCommand {
// SUPER REPAIR // SUPER REPAIR
if (canSuperRepair) { if (canSuperRepair) {
String[] superRepairStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.SUPER_REPAIR, isLucky); String[] superRepairStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SUPER_REPAIR, isLucky);
superRepairChance = superRepairStrings[0]; superRepairChance = superRepairStrings[0];
superRepairChanceLucky = superRepairStrings[1]; superRepairChanceLucky = superRepairStrings[1];
} }
@ -74,10 +74,10 @@ public class RepairCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canSuperRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.SUPER_REPAIR); canSuperRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SUPER_REPAIR);
canMasterRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.REPAIR_MASTERY); canMasterRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.REPAIR_MASTERY);
canArcaneForge = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.ARCANE_FORGING); canArcaneForge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_FORGING);
canSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.SALVAGE); canSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SALVAGE);
canRepairDiamond = Permissions.repairDiamond(player); canRepairDiamond = Permissions.repairDiamond(player);
canRepairGold = Permissions.repairGold(player); canRepairGold = Permissions.repairGold(player);
canRepairIron = Permissions.repairIron(player); canRepairIron = Permissions.repairIron(player);

View File

@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.child.FamilyTree; import com.gmail.nossr50.skills.child.FamilyTree;
@ -137,7 +137,7 @@ public abstract class SkillCommand implements TabExecutor {
return displayValues; return displayValues;
} }
protected String[] calculateAbilityDisplayValues(float skillValue, SecondaryAbilityType skillAbility, boolean isLucky) { protected String[] calculateAbilityDisplayValues(float skillValue, SecondaryAbility skillAbility, boolean isLucky) {
int maxBonusLevel = AdvancedConfig.getInstance().getMaxBonusLevel(skillAbility); int maxBonusLevel = AdvancedConfig.getInstance().getMaxBonusLevel(skillAbility);
return calculateAbilityDisplayValues((AdvancedConfig.getInstance().getMaxChance(skillAbility) / maxBonusLevel) * Math.min(skillValue, maxBonusLevel), isLucky); return calculateAbilityDisplayValues((AdvancedConfig.getInstance().getMaxChance(skillAbility) / maxBonusLevel) * Math.min(skillValue, maxBonusLevel), isLucky);

View File

@ -6,7 +6,7 @@ import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.smelting.Smelting; import com.gmail.nossr50.skills.smelting.Smelting;
@ -39,7 +39,7 @@ public class SmeltingCommand extends SkillCommand {
// SECOND SMELT // SECOND SMELT
if (canSecondSmelt) { if (canSecondSmelt) {
String[] secondSmeltStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.SECOND_SMELT, isLucky); String[] secondSmeltStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.SECOND_SMELT, isLucky);
secondSmeltChance = secondSmeltStrings[0]; secondSmeltChance = secondSmeltStrings[0];
secondSmeltChanceLucky = secondSmeltStrings[1]; secondSmeltChanceLucky = secondSmeltStrings[1];
} }
@ -54,9 +54,9 @@ public class SmeltingCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canFuelEfficiency = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FUEL_EFFICIENCY); canFuelEfficiency = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FUEL_EFFICIENCY);
canSecondSmelt = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.SECOND_SMELT); canSecondSmelt = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SECOND_SMELT);
canFluxMine = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FLUX_MINING); canFluxMine = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FLUX_MINING);
canVanillaXPBoost = Permissions.vanillaXpBoost(player, skill); canVanillaXPBoost = Permissions.vanillaXpBoost(player, skill);
} }

View File

@ -6,7 +6,7 @@ import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.swords.Swords; import com.gmail.nossr50.skills.swords.Swords;
@ -40,16 +40,16 @@ public class SwordsCommand extends SkillCommand {
// BLEED // BLEED
if (canBleed) { if (canBleed) {
bleedLength = (skillValue >= AdvancedConfig.getInstance().getMaxBonusLevel(SecondaryAbilityType.BLEED)) ? Swords.bleedMaxTicks : Swords.bleedBaseTicks; bleedLength = (skillValue >= AdvancedConfig.getInstance().getMaxBonusLevel(SecondaryAbility.BLEED)) ? Swords.bleedMaxTicks : Swords.bleedBaseTicks;
String[] bleedStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.BLEED, isLucky); String[] bleedStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.BLEED, isLucky);
bleedChance = bleedStrings[0]; bleedChance = bleedStrings[0];
bleedChanceLucky = bleedStrings[1]; bleedChanceLucky = bleedStrings[1];
} }
// COUNTER // COUNTER
if (canCounter) { if (canCounter) {
String[] counterStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.COUNTER, isLucky); String[] counterStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.COUNTER, isLucky);
counterChance = counterStrings[0]; counterChance = counterStrings[0];
counterChanceLucky = counterStrings[1]; counterChanceLucky = counterStrings[1];
} }
@ -57,8 +57,8 @@ public class SwordsCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canBleed = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.BLEED); canBleed = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.BLEED);
canCounter = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.COUNTER); canCounter = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.COUNTER);
canSerratedStrike = Permissions.serratedStrikes(player); canSerratedStrike = Permissions.serratedStrikes(player);
} }

View File

@ -7,7 +7,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.taming.Taming; import com.gmail.nossr50.skills.taming.Taming;
@ -34,7 +34,7 @@ public class TamingCommand extends SkillCommand {
@Override @Override
protected void dataCalculations(Player player, float skillValue, boolean isLucky) { protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
if (canGore) { if (canGore) {
String[] goreStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.GORE, isLucky); String[] goreStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.GORE, isLucky);
goreChance = goreStrings[0]; goreChance = goreStrings[0];
goreChanceLucky = goreStrings[1]; goreChanceLucky = goreStrings[1];
} }
@ -42,15 +42,15 @@ public class TamingCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canBeastLore = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.BEAST_LORE); canBeastLore = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.BEAST_LORE);
canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT); canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT);
canEnvironmentallyAware = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.ENVIROMENTALLY_AWARE); canEnvironmentallyAware = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ENVIROMENTALLY_AWARE);
canFastFood = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FAST_FOOD); canFastFood = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FAST_FOOD);
canGore = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.GORE); canGore = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GORE);
canSharpenedClaws = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.SHARPENED_CLAWS); canSharpenedClaws = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHARPENED_CLAWS);
canShockProof = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.SHOCK_PROOF); canShockProof = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SHOCK_PROOF);
canThickFur = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.THICK_FUR); canThickFur = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.THICK_FUR);
canHolyHound = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.HOLY_HOUND); canHolyHound = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HOLY_HOUND);
} }
@Override @Override

View File

@ -5,7 +5,7 @@ import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.unarmed.Unarmed; import com.gmail.nossr50.skills.unarmed.Unarmed;
@ -43,14 +43,14 @@ public class UnarmedCommand extends SkillCommand {
// DISARM // DISARM
if (canDisarm) { if (canDisarm) {
String[] disarmStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.DISARM, isLucky); String[] disarmStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DISARM, isLucky);
disarmChance = disarmStrings[0]; disarmChance = disarmStrings[0];
disarmChanceLucky = disarmStrings[1]; disarmChanceLucky = disarmStrings[1];
} }
// DEFLECT // DEFLECT
if (canDeflect) { if (canDeflect) {
String[] deflectStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.DEFLECT, isLucky); String[] deflectStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.DEFLECT, isLucky);
deflectChance = deflectStrings[0]; deflectChance = deflectStrings[0];
deflectChanceLucky = deflectStrings[1]; deflectChanceLucky = deflectStrings[1];
} }
@ -62,7 +62,7 @@ public class UnarmedCommand extends SkillCommand {
// IRON GRIP // IRON GRIP
if (canIronGrip) { if (canIronGrip) {
String[] ironGripStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.IRON_GRIP, isLucky); String[] ironGripStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.IRON_GRIP, isLucky);
ironGripChance = ironGripStrings[0]; ironGripChance = ironGripStrings[0];
ironGripChanceLucky = ironGripStrings[1]; ironGripChanceLucky = ironGripStrings[1];
} }
@ -71,10 +71,10 @@ public class UnarmedCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canBerserk = Permissions.berserk(player); canBerserk = Permissions.berserk(player);
canIronArm = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.IRON_ARM); canIronArm = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.IRON_ARM);
canDeflect = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.DEFLECT); canDeflect = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DEFLECT);
canDisarm = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.DISARM); canDisarm = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.DISARM);
canIronGrip = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.IRON_GRIP); canIronGrip = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.IRON_GRIP);
// TODO: Apparently we forgot about block cracker? // TODO: Apparently we forgot about block cracker?
} }

View File

@ -6,7 +6,7 @@ import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -36,7 +36,7 @@ public class WoodcuttingCommand extends SkillCommand {
// DOUBLE DROPS // DOUBLE DROPS
if (canDoubleDrop) { if (canDoubleDrop) {
String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbilityType.WOODCUTTING_DOUBLE_DROPS, isLucky); String[] doubleDropStrings = calculateAbilityDisplayValues(skillValue, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS, isLucky);
doubleDropChance = doubleDropStrings[0]; doubleDropChance = doubleDropStrings[0];
doubleDropChanceLucky = doubleDropStrings[1]; doubleDropChanceLucky = doubleDropStrings[1];
} }
@ -45,8 +45,8 @@ public class WoodcuttingCommand extends SkillCommand {
@Override @Override
protected void permissionsCheck(Player player) { protected void permissionsCheck(Player player) {
canTreeFell = Permissions.treeFeller(player); canTreeFell = Permissions.treeFeller(player);
canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.WOODCUTTING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled(); canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
canLeafBlow = Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.LEAF_BLOWER); canLeafBlow = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.LEAF_BLOWER);
} }
@Override @Override

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.skills.fishing.Fishing; import com.gmail.nossr50.skills.fishing.Fishing;
import com.gmail.nossr50.skills.mining.BlastMining; import com.gmail.nossr50.skills.mining.BlastMining;
@ -43,11 +43,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
} }
/* ACROBATICS */ /* ACROBATICS */
if (getMaxChance(SecondaryAbilityType.DODGE) < 1) { if (getMaxChance(SecondaryAbility.DODGE) < 1) {
reason.add("Skills.Acrobatics.Dodge.ChanceMax should be at least 1!"); reason.add("Skills.Acrobatics.Dodge.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.DODGE) < 1) { if (getMaxBonusLevel(SecondaryAbility.DODGE) < 1) {
reason.add("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!"); reason.add("Skills.Acrobatics.Dodge.MaxBonusLevel should be at least 1!");
} }
@ -55,11 +55,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!"); reason.add("Skills.Acrobatics.Dodge.DamageModifier should be greater than 1!");
} }
if (getMaxChance(SecondaryAbilityType.ROLL) < 1) { if (getMaxChance(SecondaryAbility.ROLL) < 1) {
reason.add("Skills.Acrobatics.Roll.ChanceMax should be at least 1!"); reason.add("Skills.Acrobatics.Roll.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.ROLL) < 1) { if (getMaxBonusLevel(SecondaryAbility.ROLL) < 1) {
reason.add("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!"); reason.add("Skills.Acrobatics.Roll.MaxBonusLevel should be at least 1!");
} }
@ -67,11 +67,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!"); reason.add("Skills.Acrobatics.Roll.DamageThreshold should be at least 0!");
} }
if (getMaxChance(SecondaryAbilityType.GRACEFUL_ROLL) < 1) { if (getMaxChance(SecondaryAbility.GRACEFUL_ROLL) < 1) {
reason.add("Skills.Acrobatics.GracefulRoll.ChanceMax should be at least 1!"); reason.add("Skills.Acrobatics.GracefulRoll.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.GRACEFUL_ROLL) < 1) { if (getMaxBonusLevel(SecondaryAbility.GRACEFUL_ROLL) < 1) {
reason.add("Skills.Acrobatics.GracefulRoll.MaxBonusLevel should be at least 1!"); reason.add("Skills.Acrobatics.GracefulRoll.MaxBonusLevel should be at least 1!");
} }
@ -92,11 +92,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Archery.SkillShot.MaxBonus should be at least 0!"); reason.add("Skills.Archery.SkillShot.MaxBonus should be at least 0!");
} }
if (getMaxChance(SecondaryAbilityType.DAZE) < 1) { if (getMaxChance(SecondaryAbility.DAZE) < 1) {
reason.add("Skills.Acrobatics.Daze.ChanceMax should be at least 1!"); reason.add("Skills.Acrobatics.Daze.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.DAZE) < 1) { if (getMaxBonusLevel(SecondaryAbility.DAZE) < 1) {
reason.add("Skills.Acrobatics.Daze.MaxBonusLevel should be at least 1!"); reason.add("Skills.Acrobatics.Daze.MaxBonusLevel should be at least 1!");
} }
@ -104,11 +104,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Acrobatics.Daze.BonusDamage should be at least 0!"); reason.add("Skills.Acrobatics.Daze.BonusDamage should be at least 0!");
} }
if (getMaxChance(SecondaryAbilityType.RETRIEVE) < 1) { if (getMaxChance(SecondaryAbility.RETRIEVE) < 1) {
reason.add("Skills.Acrobatics.Retrieve.ChanceMax should be at least 1!"); reason.add("Skills.Acrobatics.Retrieve.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.RETRIEVE) < 1) { if (getMaxBonusLevel(SecondaryAbility.RETRIEVE) < 1) {
reason.add("Skills.Acrobatics.Retrieve.MaxBonusLevel should be at least 1!"); reason.add("Skills.Acrobatics.Retrieve.MaxBonusLevel should be at least 1!");
} }
@ -125,11 +125,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Axes.AxeMastery.MaxBonusLevel should be at least 1!"); reason.add("Skills.Axes.AxeMastery.MaxBonusLevel should be at least 1!");
} }
if (getMaxChance(SecondaryAbilityType.CRITICAL_HIT) < 1) { if (getMaxChance(SecondaryAbility.CRITICAL_HIT) < 1) {
reason.add("Skills.Axes.CriticalHit.ChanceMax should be at least 1!"); reason.add("Skills.Axes.CriticalHit.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.CRITICAL_HIT) < 1) { if (getMaxBonusLevel(SecondaryAbility.CRITICAL_HIT) < 1) {
reason.add("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!"); reason.add("Skills.Axes.CriticalHit.MaxBonusLevel should be at least 1!");
} }
@ -231,44 +231,44 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Herbalism.GreenThumb.StageChange should be at least 1!"); reason.add("Skills.Herbalism.GreenThumb.StageChange should be at least 1!");
} }
if (getMaxChance(SecondaryAbilityType.GREEN_THUMB_PLANT) < 1) { if (getMaxChance(SecondaryAbility.GREEN_THUMB_PLANT) < 1) {
reason.add("Skills.Herbalism.GreenThumb.ChanceMax should be at least 1!"); reason.add("Skills.Herbalism.GreenThumb.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.GREEN_THUMB_PLANT) < 1) { if (getMaxBonusLevel(SecondaryAbility.GREEN_THUMB_PLANT) < 1) {
reason.add("Skills.Herbalism.GreenThumb.MaxBonusLevel should be at least 1!"); reason.add("Skills.Herbalism.GreenThumb.MaxBonusLevel should be at least 1!");
} }
if (getMaxChance(SecondaryAbilityType.HERBALISM_DOUBLE_DROPS) < 1) { if (getMaxChance(SecondaryAbility.HERBALISM_DOUBLE_DROPS) < 1) {
reason.add("Skills.Herbalism.DoubleDrops.ChanceMax should be at least 1!"); reason.add("Skills.Herbalism.DoubleDrops.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.HERBALISM_DOUBLE_DROPS) < 1) { if (getMaxBonusLevel(SecondaryAbility.HERBALISM_DOUBLE_DROPS) < 1) {
reason.add("Skills.Herbalism.DoubleDrops.MaxBonusLevel should be at least 1!"); reason.add("Skills.Herbalism.DoubleDrops.MaxBonusLevel should be at least 1!");
} }
if (getMaxChance(SecondaryAbilityType.HYLIAN_LUCK) < 1) { if (getMaxChance(SecondaryAbility.HYLIAN_LUCK) < 1) {
reason.add("Skills.Herbalism.HylianLuck.ChanceMax should be at least 1!"); reason.add("Skills.Herbalism.HylianLuck.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.HYLIAN_LUCK) < 1) { if (getMaxBonusLevel(SecondaryAbility.HYLIAN_LUCK) < 1) {
reason.add("Skills.Herbalism.HylianLuck.MaxBonusLevel should be at least 1!"); reason.add("Skills.Herbalism.HylianLuck.MaxBonusLevel should be at least 1!");
} }
if (getMaxChance(SecondaryAbilityType.SHROOM_THUMB) < 1) { if (getMaxChance(SecondaryAbility.SHROOM_THUMB) < 1) {
reason.add("Skills.Herbalism.ShroomThumb.ChanceMax should be at least 1!"); reason.add("Skills.Herbalism.ShroomThumb.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.SHROOM_THUMB) < 1) { if (getMaxBonusLevel(SecondaryAbility.SHROOM_THUMB) < 1) {
reason.add("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!"); reason.add("Skills.Herbalism.ShroomThumb.MaxBonusLevel should be at least 1!");
} }
/* MINING */ /* MINING */
if (getMaxChance(SecondaryAbilityType.MINING_DOUBLE_DROPS) < 1) { if (getMaxChance(SecondaryAbility.MINING_DOUBLE_DROPS) < 1) {
reason.add("Skills.Mining.DoubleDrops.ChanceMax should be at least 1!"); reason.add("Skills.Mining.DoubleDrops.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.MINING_DOUBLE_DROPS) < 1) { if (getMaxBonusLevel(SecondaryAbility.MINING_DOUBLE_DROPS) < 1) {
reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!"); reason.add("Skills.Mining.DoubleDrops.MaxBonusLevel should be at least 1!");
} }
@ -337,11 +337,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!"); reason.add("Skills.Repair.RepairMastery.MaxBonusLevel should be at least 1!");
} }
if (getMaxChance(SecondaryAbilityType.SUPER_REPAIR) < 1) { if (getMaxChance(SecondaryAbility.SUPER_REPAIR) < 1) {
reason.add("Skills.Repair.SuperRepair.ChanceMax should be at least 1!"); reason.add("Skills.Repair.SuperRepair.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.SUPER_REPAIR) < 1) { if (getMaxBonusLevel(SecondaryAbility.SUPER_REPAIR) < 1) {
reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!"); reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!");
} }
@ -390,11 +390,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Smelting.FuelEfficiency.Multiplier should be at least 1!"); reason.add("Skills.Smelting.FuelEfficiency.Multiplier should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.SECOND_SMELT) < 1) { if (getMaxBonusLevel(SecondaryAbility.SECOND_SMELT) < 1) {
reason.add("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!"); reason.add("Skills.Smelting.SecondSmelt.MaxBonusLevel should be at least 1!");
} }
if (getMaxChance(SecondaryAbilityType.SECOND_SMELT) < 1) { if (getMaxChance(SecondaryAbility.SECOND_SMELT) < 1) {
reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!"); reason.add("Skills.Smelting.SecondSmelt.ChanceMax should be at least 1!");
} }
@ -431,11 +431,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
} }
/* SWORDS */ /* SWORDS */
if (getMaxChance(SecondaryAbilityType.BLEED) < 1) { if (getMaxChance(SecondaryAbility.BLEED) < 1) {
reason.add("Skills.Swords.Bleed.ChanceMax should be at least 1!"); reason.add("Skills.Swords.Bleed.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.BLEED) < 1) { if (getMaxBonusLevel(SecondaryAbility.BLEED) < 1) {
reason.add("Skills.Swords.Bleed.MaxBonusLevel should be at least 1!"); reason.add("Skills.Swords.Bleed.MaxBonusLevel should be at least 1!");
} }
@ -451,11 +451,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Swords.Bleed.BaseTicks should be at least 1!"); reason.add("Skills.Swords.Bleed.BaseTicks should be at least 1!");
} }
if (getMaxChance(SecondaryAbilityType.COUNTER) < 1) { if (getMaxChance(SecondaryAbility.COUNTER) < 1) {
reason.add("Skills.Swords.Counter.ChanceMax should be at least 1!"); reason.add("Skills.Swords.Counter.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.COUNTER) < 1) { if (getMaxBonusLevel(SecondaryAbility.COUNTER) < 1) {
reason.add("Skills.Swords.Counter.MaxBonusLevel should be at least 1!"); reason.add("Skills.Swords.Counter.MaxBonusLevel should be at least 1!");
} }
@ -473,11 +473,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
/* TAMING */ /* TAMING */
if (getMaxChance(SecondaryAbilityType.GORE) < 1) { if (getMaxChance(SecondaryAbility.GORE) < 1) {
reason.add("Skills.Taming.Gore.ChanceMax should be at least 1!"); reason.add("Skills.Taming.Gore.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.GORE) < 1) { if (getMaxBonusLevel(SecondaryAbility.GORE) < 1) {
reason.add("Skills.Taming.Gore.MaxBonusLevel should be at least 1!"); reason.add("Skills.Taming.Gore.MaxBonusLevel should be at least 1!");
} }
@ -534,27 +534,27 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
} }
/* UNARMED */ /* UNARMED */
if (getMaxChance(SecondaryAbilityType.DISARM) < 1) { if (getMaxChance(SecondaryAbility.DISARM) < 1) {
reason.add("Skills.Unarmed.Disarm.ChanceMax should be at least 1!"); reason.add("Skills.Unarmed.Disarm.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.DISARM) < 1) { if (getMaxBonusLevel(SecondaryAbility.DISARM) < 1) {
reason.add("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!"); reason.add("Skills.Unarmed.Disarm.MaxBonusLevel should be at least 1!");
} }
if (getMaxChance(SecondaryAbilityType.DEFLECT) < 1) { if (getMaxChance(SecondaryAbility.DEFLECT) < 1) {
reason.add("Skills.Unarmed.Deflect.ChanceMax should be at least 1!"); reason.add("Skills.Unarmed.Deflect.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.DEFLECT) < 1) { if (getMaxBonusLevel(SecondaryAbility.DEFLECT) < 1) {
reason.add("Skills.Unarmed.Deflect.MaxBonusLevel should be at least 1!"); reason.add("Skills.Unarmed.Deflect.MaxBonusLevel should be at least 1!");
} }
if (getMaxChance(SecondaryAbilityType.IRON_GRIP) < 1) { if (getMaxChance(SecondaryAbility.IRON_GRIP) < 1) {
reason.add("Skills.Unarmed.IronGrip.ChanceMax should be at least 1!"); reason.add("Skills.Unarmed.IronGrip.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.IRON_GRIP) < 1) { if (getMaxBonusLevel(SecondaryAbility.IRON_GRIP) < 1) {
reason.add("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!"); reason.add("Skills.Unarmed.IronGrip.MaxBonusLevel should be at least 1!");
} }
@ -579,11 +579,11 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 1!"); reason.add("Skills.Woodcutting.LeafBlower.UnlockLevel should be at least 1!");
} }
if (getMaxChance(SecondaryAbilityType.WOODCUTTING_DOUBLE_DROPS) < 1) { if (getMaxChance(SecondaryAbility.WOODCUTTING_DOUBLE_DROPS) < 1) {
reason.add("Skills.Woodcutting.DoubleDrops.ChanceMax should be at least 1!"); reason.add("Skills.Woodcutting.DoubleDrops.ChanceMax should be at least 1!");
} }
if (getMaxBonusLevel(SecondaryAbilityType.WOODCUTTING_DOUBLE_DROPS) < 1) { if (getMaxBonusLevel(SecondaryAbility.WOODCUTTING_DOUBLE_DROPS) < 1) {
reason.add("Skills.Woodcutting.DoubleDrops.MaxBonusLevel should be at least 1!"); reason.add("Skills.Woodcutting.DoubleDrops.MaxBonusLevel should be at least 1!");
} }
@ -614,8 +614,8 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); } public int getAbilityLength() { return config.getInt("Skills.General.Ability.IncreaseLevel", 50); }
public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); } public int getEnchantBuff() { return config.getInt("Skills.General.Ability.EnchantBuff", 5); }
public int getMaxBonusLevel(SecondaryAbilityType skillAbility) { return config.getInt("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace("_", "") + "." + "MaxBonusLevel"); } public int getMaxBonusLevel(SecondaryAbility skillAbility) { return config.getInt("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace("_", "") + "." + "MaxBonusLevel"); }
public double getMaxChance(SecondaryAbilityType skillAbility) { return config.getDouble("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace("_", "") + "." + "ChanceMax", 100.0D); } public double getMaxChance(SecondaryAbility skillAbility) { return config.getDouble("Skills." + StringUtils.getCapitalized(SkillType.bySecondaryAbility(skillAbility).toString()) + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace("_", "") + "." + "ChanceMax", 100.0D); }
/* ACROBATICS */ /* ACROBATICS */
public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); } public double getDodgeDamageModifier() { return config.getDouble("Skills.Acrobatics.Dodge.DamageModifier", 2.0D); }

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.datatypes.skills; package com.gmail.nossr50.datatypes.skills;
public enum SecondaryAbilityType { public enum SecondaryAbility {
/* ACROBATICS */ /* ACROBATICS */
DODGE, DODGE,
GRACEFUL_ROLL, GRACEFUL_ROLL,

View File

@ -34,25 +34,25 @@ import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
public enum SkillType { public enum SkillType {
ACROBATICS(AcrobaticsManager.class, Color.WHITE, ImmutableList.of(SecondaryAbilityType.DODGE, SecondaryAbilityType.GRACEFUL_ROLL, SecondaryAbilityType.ROLL)), ACROBATICS(AcrobaticsManager.class, Color.WHITE, ImmutableList.of(SecondaryAbility.DODGE, SecondaryAbility.GRACEFUL_ROLL, SecondaryAbility.ROLL)),
ARCHERY(ArcheryManager.class, Color.MAROON, ImmutableList.of(SecondaryAbilityType.DAZE, SecondaryAbilityType.RETRIEVE, SecondaryAbilityType.SKILL_SHOT)), ARCHERY(ArcheryManager.class, Color.MAROON, ImmutableList.of(SecondaryAbility.DAZE, SecondaryAbility.RETRIEVE, SecondaryAbility.SKILL_SHOT)),
AXES(AxesManager.class, Color.AQUA, AbilityType.SKULL_SPLITTER, ToolType.AXE, ImmutableList.of(SecondaryAbilityType.ARMOR_IMPACT, SecondaryAbilityType.AXE_MASTERY, SecondaryAbilityType.CRITICAL_HIT, SecondaryAbilityType.GREATER_IMPACT)), AXES(AxesManager.class, Color.AQUA, AbilityType.SKULL_SPLITTER, ToolType.AXE, ImmutableList.of(SecondaryAbility.ARMOR_IMPACT, SecondaryAbility.AXE_MASTERY, SecondaryAbility.CRITICAL_HIT, SecondaryAbility.GREATER_IMPACT)),
EXCAVATION(ExcavationManager.class, Color.fromRGB(139, 69, 19), AbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL, ImmutableList.of(SecondaryAbilityType.EXCAVATION_TREASURE_HUNTER)), EXCAVATION(ExcavationManager.class, Color.fromRGB(139, 69, 19), AbilityType.GIGA_DRILL_BREAKER, ToolType.SHOVEL, ImmutableList.of(SecondaryAbility.EXCAVATION_TREASURE_HUNTER)),
FISHING(FishingManager.class, Color.NAVY, ImmutableList.of(SecondaryAbilityType.FISHERMANS_DIET, SecondaryAbilityType.FISHING_TREASURE_HUNTER, SecondaryAbilityType.ICE_FISHING, SecondaryAbilityType.MAGIC_HUNTER, SecondaryAbilityType.MASTER_ANGLER, SecondaryAbilityType.SHAKE)), FISHING(FishingManager.class, Color.NAVY, ImmutableList.of(SecondaryAbility.FISHERMANS_DIET, SecondaryAbility.FISHING_TREASURE_HUNTER, SecondaryAbility.ICE_FISHING, SecondaryAbility.MAGIC_HUNTER, SecondaryAbility.MASTER_ANGLER, SecondaryAbility.SHAKE)),
HERBALISM(HerbalismManager.class, Color.GREEN, AbilityType.GREEN_TERRA, ToolType.HOE, ImmutableList.of(SecondaryAbilityType.FARMERS_DIET, SecondaryAbilityType.GREEN_THUMB_PLANT, SecondaryAbilityType.GREEN_THUMB_BLOCK, SecondaryAbilityType.HERBALISM_DOUBLE_DROPS, SecondaryAbilityType.HYLIAN_LUCK, SecondaryAbilityType.SHROOM_THUMB)), HERBALISM(HerbalismManager.class, Color.GREEN, AbilityType.GREEN_TERRA, ToolType.HOE, ImmutableList.of(SecondaryAbility.FARMERS_DIET, SecondaryAbility.GREEN_THUMB_PLANT, SecondaryAbility.GREEN_THUMB_BLOCK, SecondaryAbility.HERBALISM_DOUBLE_DROPS, SecondaryAbility.HYLIAN_LUCK, SecondaryAbility.SHROOM_THUMB)),
MINING(MiningManager.class, Color.GRAY, AbilityType.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SecondaryAbilityType.MINING_DOUBLE_DROPS)), MINING(MiningManager.class, Color.GRAY, AbilityType.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SecondaryAbility.MINING_DOUBLE_DROPS)),
REPAIR(RepairManager.class, Color.SILVER, ImmutableList.of(SecondaryAbilityType.ARCANE_FORGING, SecondaryAbilityType.REPAIR_MASTERY, SecondaryAbilityType.SALVAGE, SecondaryAbilityType.SUPER_REPAIR)), REPAIR(RepairManager.class, Color.SILVER, ImmutableList.of(SecondaryAbility.ARCANE_FORGING, SecondaryAbility.REPAIR_MASTERY, SecondaryAbility.SALVAGE, SecondaryAbility.SUPER_REPAIR)),
SMELTING(SmeltingManager.class, Color.YELLOW, ImmutableList.of(SecondaryAbilityType.FLUX_MINING, SecondaryAbilityType.FUEL_EFFICIENCY, SecondaryAbilityType.SECOND_SMELT)), SMELTING(SmeltingManager.class, Color.YELLOW, ImmutableList.of(SecondaryAbility.FLUX_MINING, SecondaryAbility.FUEL_EFFICIENCY, SecondaryAbility.SECOND_SMELT)),
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), AbilityType.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SecondaryAbilityType.BLEED, SecondaryAbilityType.COUNTER)), SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), AbilityType.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SecondaryAbility.BLEED, SecondaryAbility.COUNTER)),
TAMING(TamingManager.class, Color.PURPLE, ImmutableList.of(SecondaryAbilityType.BEAST_LORE, SecondaryAbilityType.CALL_OF_THE_WILD, SecondaryAbilityType.ENVIROMENTALLY_AWARE, SecondaryAbilityType.FAST_FOOD, SecondaryAbilityType.GORE, SecondaryAbilityType.HOLY_HOUND, SecondaryAbilityType.SHARPENED_CLAWS, SecondaryAbilityType.SHOCK_PROOF, SecondaryAbilityType.THICK_FUR)), TAMING(TamingManager.class, Color.PURPLE, ImmutableList.of(SecondaryAbility.BEAST_LORE, SecondaryAbility.CALL_OF_THE_WILD, SecondaryAbility.ENVIROMENTALLY_AWARE, SecondaryAbility.FAST_FOOD, SecondaryAbility.GORE, SecondaryAbility.HOLY_HOUND, SecondaryAbility.SHARPENED_CLAWS, SecondaryAbility.SHOCK_PROOF, SecondaryAbility.THICK_FUR)),
UNARMED(UnarmedManager.class, Color.BLACK, AbilityType.BERSERK, ToolType.FISTS, ImmutableList.of(SecondaryAbilityType.BLOCK_CRACKER, SecondaryAbilityType.DEFLECT, SecondaryAbilityType.DISARM, SecondaryAbilityType.IRON_ARM, SecondaryAbilityType.IRON_GRIP)), UNARMED(UnarmedManager.class, Color.BLACK, AbilityType.BERSERK, ToolType.FISTS, ImmutableList.of(SecondaryAbility.BLOCK_CRACKER, SecondaryAbility.DEFLECT, SecondaryAbility.DISARM, SecondaryAbility.IRON_ARM, SecondaryAbility.IRON_GRIP)),
WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, AbilityType.TREE_FELLER, ToolType.AXE, ImmutableList.of(SecondaryAbilityType.LEAF_BLOWER, SecondaryAbilityType.WOODCUTTING_DOUBLE_DROPS)); WOODCUTTING(WoodcuttingManager.class, Color.OLIVE, AbilityType.TREE_FELLER, ToolType.AXE, ImmutableList.of(SecondaryAbility.LEAF_BLOWER, SecondaryAbility.WOODCUTTING_DOUBLE_DROPS));
private Class<? extends SkillManager> managerClass; private Class<? extends SkillManager> managerClass;
private Color runescapeColor; private Color runescapeColor;
private AbilityType ability; private AbilityType ability;
private ToolType tool; private ToolType tool;
private List<SecondaryAbilityType> secondaryAbilities; private List<SecondaryAbility> secondaryAbilities;
public static final List<String> SKILL_NAMES; public static final List<String> SKILL_NAMES;
@ -86,11 +86,11 @@ public enum SkillType {
NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills); NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills);
} }
private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SecondaryAbilityType> secondaryAbilities) { private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SecondaryAbility> secondaryAbilities) {
this(managerClass, runescapeColor, null, null, secondaryAbilities); this(managerClass, runescapeColor, null, null, secondaryAbilities);
} }
private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, AbilityType ability, ToolType tool, List<SecondaryAbilityType> secondaryAbilities) { private SkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, AbilityType ability, ToolType tool, List<SecondaryAbility> secondaryAbilities) {
this.managerClass = managerClass; this.managerClass = managerClass;
this.runescapeColor = runescapeColor; this.runescapeColor = runescapeColor;
this.ability = ability; this.ability = ability;
@ -147,7 +147,7 @@ public enum SkillType {
return tool; return tool;
} }
public List<SecondaryAbilityType> getSkillAbilities() { public List<SecondaryAbility> getSkillAbilities() {
return secondaryAbilities; return secondaryAbilities;
} }
@ -188,7 +188,7 @@ public enum SkillType {
} }
} }
public static SkillType bySecondaryAbility(SecondaryAbilityType skillAbility) { public static SkillType bySecondaryAbility(SecondaryAbility skillAbility) {
for (SkillType type : values()) { for (SkillType type : values()) {
if (type.getSkillAbilities().contains(skillAbility)) { if (type.getSkillAbilities().contains(skillAbility)) {
return type; return type;

View File

@ -2,20 +2,24 @@ package com.gmail.nossr50.events.skills.secondaryabilities;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent; import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
public abstract class SecondaryAbilityEvent extends McMMOPlayerSkillEvent { public abstract class SecondaryAbilityEvent extends McMMOPlayerSkillEvent {
private SecondaryAbilityType secondaryAbility; private SecondaryAbility secondaryAbility;
public SecondaryAbilityEvent(Player player, SecondaryAbilityType secondaryAbility) { public SecondaryAbilityEvent(Player player, SecondaryAbility secondaryAbility) {
super(player, SkillType.bySecondaryAbility(secondaryAbility)); super(player, SkillType.bySecondaryAbility(secondaryAbility));
this.secondaryAbility = secondaryAbility; this.secondaryAbility = secondaryAbility;
} }
public SecondaryAbilityType getSecondarySkillAbility() { /**
* Gets the SecondaryAbility involved in the event
* @return the SecondaryAbility
*/
public SecondaryAbility getSecondaryAbility() {
return secondaryAbility; return secondaryAbility;
} }
} }

View File

@ -1,25 +1,37 @@
package com.gmail.nossr50.events.skills.secondaryabilities; package com.gmail.nossr50.events.skills.secondaryabilities;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
public class SecondaryAbilityWeightedActivationCheckEvent extends SecondaryAbilityEvent { public class SecondaryAbilityWeightedActivationCheckEvent extends SecondaryAbilityEvent {
private double chance; private double chance;
public SecondaryAbilityWeightedActivationCheckEvent(Player player, SecondaryAbilityType ability, double chance) { public SecondaryAbilityWeightedActivationCheckEvent(Player player, SecondaryAbility ability, double chance) {
super(player, ability); super(player, ability);
this.chance = chance; this.chance = chance;
} }
/**
* Gets the activation chance of the ability 0D being no chance, 1.0D being 100% chance
* @return The activation chance of the ability
*/
public double getChance() { public double getChance() {
return chance; return chance;
} }
/**
* Sets the activation chance of the ability [0D-1.0D]
* @param The activation chance of the ability
*/
public void setChance(double chance) { public void setChance(double chance) {
this.chance = Math.min(1D, chance); this.chance = chance;
} }
/**
* Sets the activation chance of the ability to 100% or 0%
* @param whether it should be successful or not
*/
public void setSuccessful(boolean success) { public void setSuccessful(boolean success) {
this.chance = success ? 1.0D : 0D; this.chance = success ? 1.0D : 0D;
} }

View File

@ -36,7 +36,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent; import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent; import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.party.PartyManager;
@ -516,7 +516,7 @@ public class EntityListener implements Listener {
case GOLDEN_CARROT: /* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */ case GOLDEN_CARROT: /* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */
case MUSHROOM_SOUP: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */ case MUSHROOM_SOUP: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
case PUMPKIN_PIE: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */ case PUMPKIN_PIE: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FARMERS_DIET)) { if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET)) {
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel1, newFoodLevel)); event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel1, newFoodLevel));
} }
return; return;
@ -525,19 +525,19 @@ public class EntityListener implements Listener {
case MELON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */ case MELON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
case POISONOUS_POTATO: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */ case POISONOUS_POTATO: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
case POTATO_ITEM: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */ case POTATO_ITEM: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FARMERS_DIET)) { if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET)) {
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel)); event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
} }
return; return;
case COOKED_FISH: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */ case COOKED_FISH: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FISHERMANS_DIET)) { if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET)) {
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel1, newFoodLevel)); event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel1, newFoodLevel));
} }
return; return;
case RAW_FISH: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */ case RAW_FISH: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FISHERMANS_DIET)) { if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET)) {
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel)); event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
} }
return; return;

View File

@ -17,7 +17,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.runnables.PlayerUpdateInventoryTask; import com.gmail.nossr50.runnables.PlayerUpdateInventoryTask;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
@ -74,7 +74,7 @@ public class InventoryListener implements Listener {
Player player = Misc.getPlayerFromFurnace(furnaceBlock); Player player = Misc.getPlayerFromFurnace(furnaceBlock);
if (Misc.isNPCEntity(player) || !Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FUEL_EFFICIENCY)) { if (Misc.isNPCEntity(player) || !Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FUEL_EFFICIENCY)) {
return; return;
} }

View File

@ -36,7 +36,7 @@ import com.gmail.nossr50.datatypes.chat.ChatMode;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.ShareHandler; import com.gmail.nossr50.party.ShareHandler;
@ -433,7 +433,7 @@ public class PlayerListener implements Listener {
} }
} }
/* SALVAGE CHECKS */ /* SALVAGE CHECKS */
else if (type == Repair.salvageAnvilMaterial && Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.SALVAGE) && Repair.isSalvageable(heldItem)) { else if (type == Repair.salvageAnvilMaterial && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SALVAGE) && Repair.isSalvageable(heldItem)) {
RepairManager repairManager = mcMMOPlayer.getRepairManager(); RepairManager repairManager = mcMMOPlayer.getRepairManager();
event.setCancelled(true); event.setCancelled(true);
@ -471,7 +471,7 @@ public class PlayerListener implements Listener {
} }
} }
/* SALVAGE CHECKS */ /* SALVAGE CHECKS */
else if (type == Repair.salvageAnvilMaterial && Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.SALVAGE) && Repair.isSalvageable(heldItem)) { else if (type == Repair.salvageAnvilMaterial && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SALVAGE) && Repair.isSalvageable(heldItem)) {
RepairManager repairManager = mcMMOPlayer.getRepairManager(); RepairManager repairManager = mcMMOPlayer.getRepairManager();
// Cancel salvaging an enchanted item // Cancel salvaging an enchanted item

View File

@ -10,7 +10,7 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.SkillManager;
@ -28,11 +28,11 @@ public class AcrobaticsManager extends SkillManager {
} }
public boolean canRoll() { public boolean canRoll() {
return !exploitPrevention() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.ROLL); return !exploitPrevention() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ROLL);
} }
public boolean canDodge(Entity damager) { public boolean canDodge(Entity damager) {
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.DODGE)) { if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.DODGE)) {
if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) { if (damager instanceof LightningStrike && Acrobatics.dodgeLightningDisabled) {
return false; return false;
} }
@ -53,7 +53,7 @@ public class AcrobaticsManager extends SkillManager {
double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier); double modifiedDamage = Acrobatics.calculateModifiedDodgeDamage(damage, Acrobatics.dodgeDamageModifier);
Player player = getPlayer(); Player player = getPlayer();
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbilityType.DODGE, player, getSkillLevel(), activationChance)) { if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbility.DODGE, player, getSkillLevel(), activationChance)) {
ParticleEffectUtils.playDodgeEffect(player); ParticleEffectUtils.playDodgeEffect(player);
if (mcMMOPlayer.useChatNotifications()) { if (mcMMOPlayer.useChatNotifications()) {
@ -80,13 +80,13 @@ public class AcrobaticsManager extends SkillManager {
public double rollCheck(double damage) { public double rollCheck(double damage) {
Player player = getPlayer(); Player player = getPlayer();
if (player.isSneaking() && Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.GRACEFUL_ROLL)) { if (player.isSneaking() && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.GRACEFUL_ROLL)) {
return gracefulRollCheck(damage); return gracefulRollCheck(damage);
} }
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.rollThreshold); double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.rollThreshold);
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbilityType.ROLL, player, getSkillLevel(), activationChance)) { if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbility.ROLL, player, getSkillLevel(), activationChance)) {
player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text")); player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
applyXpGain(calculateRollXP(damage, true)); applyXpGain(calculateRollXP(damage, true));
@ -110,7 +110,7 @@ public class AcrobaticsManager extends SkillManager {
private double gracefulRollCheck(double damage) { private double gracefulRollCheck(double damage) {
double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.gracefulRollThreshold); double modifiedDamage = Acrobatics.calculateModifiedRollDamage(damage, Acrobatics.gracefulRollThreshold);
if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbilityType.GRACEFUL_ROLL, getPlayer(), getSkillLevel(), activationChance)) { if (!isFatal(modifiedDamage) && SkillUtils.activationSuccessful(SecondaryAbility.GRACEFUL_ROLL, getPlayer(), getSkillLevel(), activationChance)) {
getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc")); getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Ability.Proc"));
applyXpGain(calculateRollXP(damage, true)); applyXpGain(calculateRollXP(damage, true));

View File

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

View File

@ -7,7 +7,7 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.ToolType; import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent; import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
@ -27,19 +27,19 @@ public class AxesManager extends SkillManager {
} }
public boolean canUseAxeMastery() { public boolean canUseAxeMastery() {
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.AXE_MASTERY); return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.AXE_MASTERY);
} }
public boolean canCriticalHit(LivingEntity target) { public boolean canCriticalHit(LivingEntity target) {
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.CRITICAL_HIT); return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.CRITICAL_HIT);
} }
public boolean canImpact(LivingEntity target) { public boolean canImpact(LivingEntity target) {
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.ARMOR_IMPACT) && Axes.hasArmor(target); return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ARMOR_IMPACT) && Axes.hasArmor(target);
} }
public boolean canGreaterImpact(LivingEntity target) { public boolean canGreaterImpact(LivingEntity target) {
return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.GREATER_IMPACT) && !Axes.hasArmor(target); return target.isValid() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.GREATER_IMPACT) && !Axes.hasArmor(target);
} }
public boolean canUseSkullSplitter(LivingEntity target) { public boolean canUseSkullSplitter(LivingEntity target) {
@ -68,7 +68,7 @@ public class AxesManager extends SkillManager {
* @param damage The amount of damage initially dealt by the event * @param damage The amount of damage initially dealt by the event
*/ */
public double criticalHit(LivingEntity target, double damage) { public double criticalHit(LivingEntity target, double damage) {
if (!SkillUtils.activationSuccessful(SecondaryAbilityType.CRITICAL_HIT, getPlayer(), getSkillLevel(), activationChance)) { if (!SkillUtils.activationSuccessful(SecondaryAbility.CRITICAL_HIT, getPlayer(), getSkillLevel(), activationChance)) {
return 0; return 0;
} }
@ -99,7 +99,7 @@ public class AxesManager extends SkillManager {
for (ItemStack armor : target.getEquipment().getArmorContents()) { for (ItemStack armor : target.getEquipment().getArmorContents()) {
if (ItemUtils.isArmor(armor)) { if (ItemUtils.isArmor(armor)) {
double chance = Axes.impactChance / activationChance; double chance = Axes.impactChance / activationChance;
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbilityType.ARMOR_IMPACT, chance); SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.ARMOR_IMPACT, chance);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) { if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
SkillUtils.handleDurabilityChange(armor, durabilityDamage, Axes.impactMaxDurabilityModifier); SkillUtils.handleDurabilityChange(armor, durabilityDamage, Axes.impactMaxDurabilityModifier);
@ -115,7 +115,7 @@ public class AxesManager extends SkillManager {
*/ */
public double greaterImpact(LivingEntity target) { public double greaterImpact(LivingEntity target) {
double chance = Axes.greaterImpactChance / activationChance; double chance = Axes.greaterImpactChance / activationChance;
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbilityType.GREATER_IMPACT, chance); SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.GREATER_IMPACT, chance);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
if ((event.getChance() * activationChance) <= Misc.getRandom().nextInt(activationChance)) { if ((event.getChance() * activationChance) <= Misc.getRandom().nextInt(activationChance)) {
return 0; return 0;

View File

@ -7,7 +7,7 @@ import org.bukkit.block.BlockState;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.SkillManager;
@ -28,7 +28,7 @@ public class ExcavationManager extends SkillManager {
public void excavationBlockCheck(BlockState blockState) { public void excavationBlockCheck(BlockState blockState) {
int xp = Excavation.getBlockXP(blockState); int xp = Excavation.getBlockXP(blockState);
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.EXCAVATION_TREASURE_HUNTER)) { if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.EXCAVATION_TREASURE_HUNTER)) {
List<ExcavationTreasure> treasures = Excavation.getTreasures(blockState); List<ExcavationTreasure> treasures = Excavation.getTreasures(blockState);
if (!treasures.isEmpty()) { if (!treasures.isEmpty()) {

View File

@ -41,7 +41,7 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.treasure.TreasureConfig; import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure; import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
import com.gmail.nossr50.datatypes.treasure.FishingTreasure; import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
@ -76,11 +76,11 @@ public class FishingManager extends SkillManager {
} }
public boolean canShake(Entity target) { public boolean canShake(Entity target) {
return target instanceof LivingEntity && getSkillLevel() >= Tier.ONE.getLevel() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.SHAKE); return target instanceof LivingEntity && getSkillLevel() >= Tier.ONE.getLevel() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.SHAKE);
} }
public boolean canMasterAngler() { public boolean canMasterAngler() {
return getSkillLevel() >= AdvancedConfig.getInstance().getMasterAnglerUnlockLevel() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.MASTER_ANGLER); return getSkillLevel() >= AdvancedConfig.getInstance().getMasterAnglerUnlockLevel() && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.MASTER_ANGLER);
} }
public boolean unleashTheKraken() { public boolean unleashTheKraken() {
@ -207,7 +207,7 @@ public class FishingManager extends SkillManager {
Player player = getPlayer(); Player player = getPlayer();
if (!Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.ICE_FISHING)) { if (!Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.ICE_FISHING)) {
return false; return false;
} }
@ -308,7 +308,7 @@ public class FishingManager extends SkillManager {
Player player = getPlayer(); Player player = getPlayer();
FishingTreasure treasure = null; FishingTreasure treasure = null;
if (Config.getInstance().getFishingDropsEnabled() && Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.FISHING_TREASURE_HUNTER)) { if (Config.getInstance().getFishingDropsEnabled() && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHING_TREASURE_HUNTER)) {
treasure = getFishingTreasure(); treasure = getFishingTreasure();
this.fishingCatch = null; this.fishingCatch = null;
} }
@ -319,7 +319,7 @@ public class FishingManager extends SkillManager {
ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay? ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay?
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>(); Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbilityType.MAGIC_HUNTER) && ItemUtils.isEnchantable(treasureDrop)) { if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.MAGIC_HUNTER) && ItemUtils.isEnchantable(treasureDrop)) {
enchants = handleMagicHunter(treasureDrop); enchants = handleMagicHunter(treasureDrop);
} }
@ -377,7 +377,7 @@ public class FishingManager extends SkillManager {
public void shakeCheck(LivingEntity target) { public void shakeCheck(LivingEntity target) {
fishingTries--; // Because autoclicking to shake is OK. fishingTries--; // Because autoclicking to shake is OK.
SecondaryAbilityWeightedActivationCheckEvent activationEvent = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbilityType.SHAKE, getShakeProbability() / activationChance); SecondaryAbilityWeightedActivationCheckEvent activationEvent = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.SHAKE, getShakeProbability() / activationChance);
mcMMO.p.getServer().getPluginManager().callEvent(activationEvent); mcMMO.p.getServer().getPluginManager().callEvent(activationEvent);
if ((activationEvent.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) { if ((activationEvent.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
List<ShakeTreasure> possibleDrops = Fishing.findPossibleDrops(target); List<ShakeTreasure> possibleDrops = Fishing.findPossibleDrops(target);

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent; import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
@ -25,11 +25,11 @@ public class SmeltingManager extends SkillManager {
} }
public boolean canUseFluxMining(BlockState blockState) { public boolean canUseFluxMining(BlockState blockState) {
return getSkillLevel() >= Smelting.fluxMiningUnlockLevel && BlockUtils.affectedByFluxMining(blockState) && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.FLUX_MINING) && !mcMMO.getPlaceStore().isTrue(blockState); return getSkillLevel() >= Smelting.fluxMiningUnlockLevel && BlockUtils.affectedByFluxMining(blockState) && Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.FLUX_MINING) && !mcMMO.getPlaceStore().isTrue(blockState);
} }
public boolean isSecondSmeltSuccessful() { public boolean isSecondSmeltSuccessful() {
return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbilityType.SECOND_SMELT) && SkillUtils.activationSuccessful(SecondaryAbilityType.SECOND_SMELT, getPlayer(), getSkillLevel(), activationChance); return Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.SECOND_SMELT) && SkillUtils.activationSuccessful(SecondaryAbility.SECOND_SMELT, getPlayer(), getSkillLevel(), activationChance);
} }
/** /**
@ -41,7 +41,7 @@ public class SmeltingManager extends SkillManager {
public boolean processFluxMining(BlockState blockState) { public boolean processFluxMining(BlockState blockState) {
Player player = getPlayer(); Player player = getPlayer();
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbilityType.FLUX_MINING, Smelting.fluxMiningChance / activationChance); SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(getPlayer(), SecondaryAbility.FLUX_MINING, Smelting.fluxMiningChance / activationChance);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) { if ((event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance)) {
ItemStack item = null; ItemStack item = null;

View File

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

View File

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

View File

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

View File

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

View File

@ -11,7 +11,7 @@ import org.bukkit.plugin.PluginManager;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.commands.party.PartySubcommandType; import com.gmail.nossr50.commands.party.PartySubcommandType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
public final class Permissions { public final class Permissions {
@ -125,7 +125,7 @@ public final class Permissions {
public static boolean skillEnabled(Permissible permissible, SkillType skill) {return permissible.hasPermission("mcmmo.skills." + skill.toString().toLowerCase()); } public static boolean skillEnabled(Permissible permissible, SkillType skill) {return permissible.hasPermission("mcmmo.skills." + skill.toString().toLowerCase()); }
public static boolean vanillaXpBoost(Permissible permissible, SkillType skill) { return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase() + ".vanillaxpboost"); } public static boolean vanillaXpBoost(Permissible permissible, SkillType skill) { return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase() + ".vanillaxpboost"); }
public static boolean secondaryAbilityEnabled(Permissible permissible, SecondaryAbilityType skillAbility) { return permissible.hasPermission("mcmmo.ability." + SkillType.bySecondaryAbility(skillAbility).toString().toLowerCase() + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace("_", "").toLowerCase()); } public static boolean secondaryAbilityEnabled(Permissible permissible, SecondaryAbility skillAbility) { return permissible.hasPermission("mcmmo.ability." + SkillType.bySecondaryAbility(skillAbility).toString().toLowerCase() + "." + StringUtils.getPrettySecondaryAbilityString(skillAbility).replace("_", "").toLowerCase()); }
/* AXES */ /* AXES */
public static boolean skullSplitter(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.axes.skullsplitter"); } public static boolean skullSplitter(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.axes.skullsplitter"); }

View File

@ -4,7 +4,7 @@ import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
public class StringUtils { public class StringUtils {
/** /**
@ -29,7 +29,7 @@ public class StringUtils {
return createPrettyEnumString(ability.toString()); return createPrettyEnumString(ability.toString());
} }
public static String getPrettySecondaryAbilityString(SecondaryAbilityType secondaryAbility) { public static String getPrettySecondaryAbilityString(SecondaryAbility secondaryAbility) {
switch(secondaryAbility) { switch(secondaryAbility) {
case HERBALISM_DOUBLE_DROPS: case HERBALISM_DOUBLE_DROPS:
case MINING_DOUBLE_DROPS: case MINING_DOUBLE_DROPS:

View File

@ -18,7 +18,7 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.HiddenConfig; import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SecondaryAbilityType; import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent; import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
@ -189,15 +189,15 @@ public class SkillUtils {
itemStack.setDurability((short) Math.min(itemStack.getDurability() + durabilityModifier, maxDurability)); itemStack.setDurability((short) Math.min(itemStack.getDurability() + durabilityModifier, maxDurability));
} }
public static boolean activationSuccessful(SecondaryAbilityType skillAbility, Player player, SkillType skill) { public static boolean activationSuccessful(SecondaryAbility skillAbility, Player player, SkillType skill) {
return activationSuccessful(skillAbility, player, UserManager.getPlayer(player).getSkillLevel(skill), PerksUtils.handleLuckyPerks(player, skill)); return activationSuccessful(skillAbility, player, UserManager.getPlayer(player).getSkillLevel(skill), PerksUtils.handleLuckyPerks(player, skill));
} }
public static boolean activationSuccessful(SecondaryAbilityType skillAbility, Player player, int skillLevel, int activationChance) { public static boolean activationSuccessful(SecondaryAbility skillAbility, Player player, int skillLevel, int activationChance) {
return activationSuccessful(skillAbility, player, skillLevel, activationChance, AdvancedConfig.getInstance().getMaxChance(skillAbility), AdvancedConfig.getInstance().getMaxBonusLevel(skillAbility)); return activationSuccessful(skillAbility, player, skillLevel, activationChance, AdvancedConfig.getInstance().getMaxChance(skillAbility), AdvancedConfig.getInstance().getMaxBonusLevel(skillAbility));
} }
public static boolean activationSuccessful(SecondaryAbilityType skillAbility, Player player, int skillLevel, int activationChance, double maxChance, int maxLevel) { public static boolean activationSuccessful(SecondaryAbility skillAbility, Player player, int skillLevel, int activationChance, double maxChance, int maxLevel) {
double chance = (maxChance / maxLevel) * Math.min(skillLevel, maxLevel) / activationChance; double chance = (maxChance / maxLevel) * Math.min(skillLevel, maxLevel) / activationChance;
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, skillAbility, chance); SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, skillAbility, chance);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
@ -205,7 +205,7 @@ public class SkillUtils {
} }
public static boolean treasureDropSuccessful(Player player, double dropChance, int activationChance) {; public static boolean treasureDropSuccessful(Player player, double dropChance, int activationChance) {;
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, SecondaryAbilityType.EXCAVATION_TREASURE_HUNTER, dropChance / activationChance); SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, SecondaryAbility.EXCAVATION_TREASURE_HUNTER, dropChance / activationChance);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
return (event.getChance() * activationChance) > (Misc.getRandom().nextDouble() * activationChance); return (event.getChance() * activationChance) > (Misc.getRandom().nextDouble() * activationChance);
} }