Fixing more errors with typecasting.

This commit is contained in:
Glitchfinder 2012-11-25 16:40:42 -08:00
parent 082fa2ca0d
commit 0037524cfd
15 changed files with 137 additions and 137 deletions

View File

@ -14,56 +14,56 @@ public class AdvancedConfig extends ConfigLoader {
return instance; return instance;
} }
@Override @Override
protected void loadKeys() { protected void loadKeys() {
// TODO Do I need to use this? // TODO Do I need to use this?
} }
/* GENERAL */ /* GENERAL */
public int getAbilityLength() { return config.getInt("Skills.General.Ability_IncreaseLevel", 50); } public int getAbilityLength() { return config.getInt("Skills.General.Ability_IncreaseLevel", 50); }
/* ACROBATICS */ /* ACROBATICS */
public int getDodgeChanceMax() { return config.getInt("Skills.Acrobatics.Dodge_ChanceMax", 20); } public int getDodgeChanceMax() { return config.getInt("Skills.Acrobatics.Dodge_ChanceMax", 20); }
public int getDodgeMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Dodge_MaxBonusLevel", 800); } public int getDodgeMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Dodge_MaxBonusLevel", 800); }
public int getRollChanceMax() { return config.getInt("Skills.Acrobatics.Roll_ChanceMax", 100); } public int getRollChanceMax() { return config.getInt("Skills.Acrobatics.Roll_ChanceMax", 100); }
public int getRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Roll_MaxBonusLevel", 1000); } public int getRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.Roll_MaxBonusLevel", 1000); }
public int getGracefulRollChanceMax() { return config.getInt("Skills.Acrobatics.GracefulRoll_ChanceMax", 100); } public int getGracefulRollChanceMax() { return config.getInt("Skills.Acrobatics.GracefulRoll_ChanceMax", 100); }
public int getGracefulRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.GracefulRoll_MaxBonusLevel", 500); } public int getGracefulRollMaxBonusLevel() { return config.getInt("Skills.Acrobatics.GracefulRoll_MaxBonusLevel", 500); }
public int getDodgeXPModifier() { return config.getInt("Skills.Acrobatics.Dodge_XP_Modifier", 120); } public int getDodgeXPModifier() { return config.getInt("Skills.Acrobatics.Dodge_XP_Modifier", 120); }
public int getRollXPModifier() { return config.getInt("Skills.Acrobatics.Roll_XP_Modifier", 80); } public int getRollXPModifier() { return config.getInt("Skills.Acrobatics.Roll_XP_Modifier", 80); }
public int getFallXPModifier() { return config.getInt("Skills.Acrobatics.Fall_XP_Modifier", 120); } public int getFallXPModifier() { return config.getInt("Skills.Acrobatics.Fall_XP_Modifier", 120); }
/* ARCHERY */ /* ARCHERY */
public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot_IncreaseLevel", 50); } public int getSkillShotIncreaseLevel() { return config.getInt("Skills.Archery.SkillShot_IncreaseLevel", 50); }
public double getSkillShotIncreasePercentage() { return config.getDouble("Skills.Archery.SkillShot_IncreasePercentage", 0.1D); } public double getSkillShotIncreasePercentage() { return config.getDouble("Skills.Archery.SkillShot_IncreasePercentage", 0.1D); }
public double getSkillShotBonusMax() { return config.getDouble("Skills.Archery.SkillShot_MaxBonus", 2.0D); } public double getSkillShotBonusMax() { return config.getDouble("Skills.Archery.SkillShot_MaxBonus", 2.0D); }
public int getDazeBonusMax() { return config.getInt("Skills.Archery.Daze_MaxChance", 50); } public int getDazeBonusMax() { return config.getInt("Skills.Archery.Daze_MaxChance", 50); }
public int getDazeMaxBonusLevel() { return config.getInt("Skills.Archery.Daze_MaxBonusLevel", 1000); } public int getDazeMaxBonusLevel() { return config.getInt("Skills.Archery.Daze_MaxBonusLevel", 1000); }
public int getDazeModifier() { return config.getInt("Skills.Archery.Daze_BonusDamage", 4); } public int getDazeModifier() { return config.getInt("Skills.Archery.Daze_BonusDamage", 4); }
public int getRetrieveBonusMax() { return config.getInt("Skills.Archery.Retrieve_MaxBonus", 100); } public int getRetrieveBonusMax() { return config.getInt("Skills.Archery.Retrieve_MaxBonus", 100); }
public int getRetrieveMaxBonusLevel() { return config.getInt("Skills.Archery.Retrieve_MaxBonusLevel", 1000); } public int getRetrieveMaxBonusLevel() { return config.getInt("Skills.Archery.Retrieve_MaxBonusLevel", 1000); }
/* AXES */ /* AXES */
public int getBonusDamageAxesBonusMax() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonus", 4); } public int getBonusDamageAxesBonusMax() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonus", 4); }
public int getBonusDamageAxesMaxBonusLevel() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonusLevel", 200); } public int getBonusDamageAxesMaxBonusLevel() { return config.getInt("Skills.Axes.DamageIncrease_MaxBonusLevel", 200); }
public double getAxesCriticalChance() { return config.getDouble("Skills.Axes.AxesCritical_MaxChance", 37.50); } public double getAxesCriticalChance() { return config.getDouble("Skills.Axes.AxesCritical_MaxChance", 37.50); }
public int getAxesCriticalMaxBonusLevel() { return config.getInt("Skills.Axes.AxesCritical_MaxBonusLevel", 750); } public int getAxesCriticalMaxBonusLevel() { return config.getInt("Skills.Axes.AxesCritical_MaxBonusLevel", 750); }
public double getAxesCriticalPVPModifier() { return config.getDouble("Skills.Axes.AxesCritical_PVP_Modifier", 1.5); } public double getAxesCriticalPVPModifier() { return config.getDouble("Skills.Axes.AxesCritical_PVP_Modifier", 1.5); }
public int getAxesCriticalPVEModifier() { return config.getInt("Skills.Axes.AxesCritical_PVE_Modifier", 2); } public int getAxesCriticalPVEModifier() { return config.getInt("Skills.Axes.AxesCritical_PVE_Modifier", 2); }
public int getGreaterImpactChance() { return config.getInt("Skills.Axes.GreaterImpact_Chance", 25); } public int getGreaterImpactChance() { return config.getInt("Skills.Axes.GreaterImpact_Chance", 25); }
public int getGreaterImpactIncreaseLevel() { return config.getInt("Skills.Axes.GreaterImpact_IncreaseLevel", 50); } public int getGreaterImpactIncreaseLevel() { return config.getInt("Skills.Axes.GreaterImpact_IncreaseLevel", 50); }
public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact_KnockbackModifier", 1.5); } public double getGreaterImpactModifier() { return config.getDouble("Skills.Axes.GreaterImpact_KnockbackModifier", 1.5); }
public int getGreaterImpactBonusDamage() { return config.getInt("Skills.Axes.GreaterImpact_BonusDamage", 2); } public int getGreaterImpactBonusDamage() { return config.getInt("Skills.Axes.GreaterImpact_BonusDamage", 2); }
/* EXCAVATION */ /* EXCAVATION */
//Nothing to configure, everything is already configurable in config.yml //Nothing to configure, everything is already configurable in config.yml
/* FISHING */ /* FISHING */
public int getShakeUnlockLevel() { return config.getInt("Skills.Fishing.Shake_UnlockLevel", 150); } public int getShakeUnlockLevel() { return config.getInt("Skills.Fishing.Shake_UnlockLevel", 150); }
public int getFishingEnchantmentChance() { return config.getInt("Skills.Fishing.Enchantment_Chance", 10); } public int getFishingEnchantmentChance() { return config.getInt("Skills.Fishing.Enchantment_Chance", 10); }
@ -97,56 +97,56 @@ public class AdvancedConfig extends ConfigLoader {
public int getSuperRepairMaxLevel() { return config.getInt("Skills.Repair.SuperRepair_MaxBonusLevel", 1000); } public int getSuperRepairMaxLevel() { return config.getInt("Skills.Repair.SuperRepair_MaxBonusLevel", 1000); }
/* SWORDS */ /* SWORDS */
public int getBleedChanceMax() { return config.getInt("Skills.Sword.Bleed_ChanceMax", 75); } public int getBleedChanceMax() { return config.getInt("Skills.Sword.Bleed_ChanceMax", 75); }
public int getBleedMaxBonusLevel() { return config.getInt("Skills.Sword.Bleed_MaxBonusLevel", 750); } public int getBleedMaxBonusLevel() { return config.getInt("Skills.Sword.Bleed_MaxBonusLevel", 750); }
public int getBleedMaxTicks() { return config.getInt("Skills.Sword.Bleed_MaxTicks", 3); } public int getBleedMaxTicks() { return config.getInt("Skills.Sword.Bleed_MaxTicks", 3); }
public int getBleedBaseTicks() { return config.getInt("Skills.Sword.Bleed_BaseTicks", 2); } public int getBleedBaseTicks() { return config.getInt("Skills.Sword.Bleed_BaseTicks", 2); }
public int getCounterChanceMax() { return config.getInt("Skills.Sword.Counter_ChanceMax", 30); } public int getCounterChanceMax() { return config.getInt("Skills.Sword.Counter_ChanceMax", 30); }
public int getCounterMaxBonusLevel() { return config.getInt("Skills.Sword.Counter_MaxBonusLevel", 600); } public int getCounterMaxBonusLevel() { return config.getInt("Skills.Sword.Counter_MaxBonusLevel", 600); }
public int getCounterModifier() { return config.getInt("Skills.Sword.Counter_DamageModifier", 2); } public int getCounterModifier() { return config.getInt("Skills.Sword.Counter_DamageModifier", 2); }
public int getSerratedStrikesModifier() { return config.getInt("Skills.Sword.SerratedStrikes_DamageModifier", 4); } public int getSerratedStrikesModifier() { return config.getInt("Skills.Sword.SerratedStrikes_DamageModifier", 4); }
public int getSerratedStrikesTicks() { return config.getInt("Skills.Sword.SerratedStrikes_BleedTicks", 5); } public int getSerratedStrikesTicks() { return config.getInt("Skills.Sword.SerratedStrikes_BleedTicks", 5); }
/* TAMING */ /* TAMING */
public int getGoreChanceMax() { return config.getInt("Skills.Taming.Gore_ChanceMax", 100); } public int getGoreChanceMax() { return config.getInt("Skills.Taming.Gore_ChanceMax", 100); }
public int getGoreMaxBonusLevel() { return config.getInt("Skills.Taming.Gore_MaxBonusLevel", 1000); } public int getGoreMaxBonusLevel() { return config.getInt("Skills.Taming.Gore_MaxBonusLevel", 1000); }
public int getGoreBleedTicks() { return config.getInt("Skills.Taming.Gore_BleedTicks", 2); } public int getGoreBleedTicks() { return config.getInt("Skills.Taming.Gore_BleedTicks", 2); }
public int getGoreModifier() { return config.getInt("Skills.Taming.Gore_Modifier", 2); } public int getGoreModifier() { return config.getInt("Skills.Taming.Gore_Modifier", 2); }
public int getFastFoodUnlock() { return config.getInt("Skills.Taming.FastFood_UnlockLevel", 50); } public int getFastFoodUnlock() { return config.getInt("Skills.Taming.FastFood_UnlockLevel", 50); }
public int getFastFoodChance() { return config.getInt("Skills.Taming.FastFood_Chance", 50); } public int getFastFoodChance() { return config.getInt("Skills.Taming.FastFood_Chance", 50); }
public int getEnviromentallyAwareUnlock() { return config.getInt("Skills.Taming.EnvironmentallyAware_UnlockLevel", 100); } public int getEnviromentallyAwareUnlock() { return config.getInt("Skills.Taming.EnvironmentallyAware_UnlockLevel", 100); }
public int getThickFurUnlock() { return config.getInt("Skills.Taming.ThickFur_UnlockLevel", 250); } public int getThickFurUnlock() { return config.getInt("Skills.Taming.ThickFur_UnlockLevel", 250); }
public int getThickFurModifier() { return config.getInt("Skills.Taming.ThickFur_Modifier", 2); } public int getThickFurModifier() { return config.getInt("Skills.Taming.ThickFur_Modifier", 2); }
public int getShockProofUnlock() { return config.getInt("Skills.Taming.ShockProof_UnlockLevel", 500); } public int getShockProofUnlock() { return config.getInt("Skills.Taming.ShockProof_UnlockLevel", 500); }
public int getShockProofModifier() { return config.getInt("Skills.Taming.ShockProof_Modifier", 6); } public int getShockProofModifier() { return config.getInt("Skills.Taming.ShockProof_Modifier", 6); }
public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws_UnlockLevel", 750); } public int getSharpenedClawsUnlock() { return config.getInt("Skills.Taming.SharpenedClaws_UnlockLevel", 750); }
public int getSharpenedClawsBonus() { return config.getInt("Skills.Taming.SharpenedClaws_Bonus", 2); } public int getSharpenedClawsBonus() { return config.getInt("Skills.Taming.SharpenedClaws_Bonus", 2); }
/* UNARMED */ /* UNARMED */
public int getDisarmChanceMax() { return config.getInt("Skills.Unarmed.Disarm_ChanceMax", 33); } public int getDisarmChanceMax() { return config.getInt("Skills.Unarmed.Disarm_ChanceMax", 33); }
public int getDisarmMaxBonusLevel() { return config.getInt("Skills.Unarmed.Disarm_MaxBonusLevel", 1000); } public int getDisarmMaxBonusLevel() { return config.getInt("Skills.Unarmed.Disarm_MaxBonusLevel", 1000); }
public int getDeflectChanceMax() { return config.getInt("Skills.Unarmed.Deflect_ChanceMax", 50); } public int getDeflectChanceMax() { return config.getInt("Skills.Unarmed.Deflect_ChanceMax", 50); }
public int getDeflectMaxBonusLevel() { return config.getInt("Skills.Unarmed.Deflect_MaxBonusLevel", 1000); } public int getDeflectMaxBonusLevel() { return config.getInt("Skills.Unarmed.Deflect_MaxBonusLevel", 1000); }
public int getIronGripChanceMax() { return config.getInt("Skills.Unarmed.IronGrip_ChanceMax", 100); } public int getIronGripChanceMax() { return config.getInt("Skills.Unarmed.IronGrip_ChanceMax", 100); }
public int getIronGripMaxBonusLevel() { return config.getInt("Skills.Unarmed.IronGrip_MaxBonusLevel", 1000); } public int getIronGripMaxBonusLevel() { return config.getInt("Skills.Unarmed.IronGrip_MaxBonusLevel", 1000); }
public int getIronArmBonus() { return config.getInt("Skills.Unarmed.IronArm_Bonus", 8); } public int getIronArmBonus() { return config.getInt("Skills.Unarmed.IronArm_Bonus", 8); }
public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArm_IncreaseLevel", 50); } public int getIronArmIncreaseLevel() { return config.getInt("Skills.Unarmed.IronArm_IncreaseLevel", 50); }
/* WOODCUTTING */ /* WOODCUTTING */
public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower_UnlockLevel", 100); } public int getLeafBlowUnlockLevel() { return config.getInt("Skills.Woodcutting.LeafBlower_UnlockLevel", 100); }
public int getWoodcuttingDoubleDropChance() { return config.getInt("Skills.Woodcutting.DoubleDrops_ChanceMax", 100); } public int getWoodcuttingDoubleDropChance() { return config.getInt("Skills.Woodcutting.DoubleDrops_ChanceMax", 100); }
public int getWoodcuttingDoubleDropMaxLevel() { return config.getInt("Skills.Woodcutting.DoubleDrops_MaxBonusLevel", 1000); } public int getWoodcuttingDoubleDropMaxLevel() { return config.getInt("Skills.Woodcutting.DoubleDrops_MaxBonusLevel", 1000); }
/* SPOUT STUFF*/ /* SPOUT STUFF*/
public int getSpoutNotificationTier1() { return config.getInt("Spout.Notifications.Tier1", 200); } public int getSpoutNotificationTier1() { return config.getInt("Spout.Notifications.Tier1", 200); }
public int getSpoutNotificationTier2() { return config.getInt("Spout.Notifications.Tier2", 400); } public int getSpoutNotificationTier2() { return config.getInt("Spout.Notifications.Tier2", 400); }
public int getSpoutNotificationTier3() { return config.getInt("Spout.Notifications.Tier3", 600); } public int getSpoutNotificationTier3() { return config.getInt("Spout.Notifications.Tier3", 600); }
public int getSpoutNotificationTier4() { return config.getInt("Spout.Notifications.Tier4", 800); } public int getSpoutNotificationTier4() { return config.getInt("Spout.Notifications.Tier4", 800); }
//TODO Make the sounds configurable! :D //TODO Make the sounds configurable! :D
// public String getSpoutSoundRepair() { return config.getString("Spout.Sounds.RepairSound", "url here"); } // public String getSpoutSoundRepair() { return config.getString("Spout.Sounds.RepairSound", "url here"); }
// public String getSpoutSoundLevelUp() { return config.getString("Spout.Sounds.LevelUp", "url here"); } // public String getSpoutSoundLevelUp() { return config.getString("Spout.Sounds.LevelUp", "url here"); }
} }

View File

@ -5,7 +5,7 @@ import java.util.Random;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
public class Acrobatics { public class Acrobatics {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
public static final int DODGE_MAX_BONUS_LEVEL = advancedConfig.getDodgeMaxBonusLevel(); public static final int DODGE_MAX_BONUS_LEVEL = advancedConfig.getDodgeMaxBonusLevel();
public static final int DODGE_XP_MODIFIER = advancedConfig.getDodgeXPModifier(); public static final int DODGE_XP_MODIFIER = advancedConfig.getDodgeXPModifier();

View File

@ -13,7 +13,7 @@ import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
public class Archery { public class Archery {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private static Random random = new Random(); private static Random random = new Random();
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>(); private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();

View File

@ -11,18 +11,18 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
public class ArcheryManager { public class ArcheryManager {
AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private Player player; private Player player;
private PlayerProfile profile; private PlayerProfile profile;
private int skillLevel; private int skillLevel;
private Permissions permissionsInstance; private Permissions permissionsInstance;
private float dazeBonusMax = advancedConfig.getDazeBonusMax(); private float dazeBonusMax = advancedConfig.getDazeBonusMax();
private float dazeMaxBonusLevel = advancedConfig.getDazeMaxBonusLevel(); private float dazeMaxBonusLevel = advancedConfig.getDazeMaxBonusLevel();
private float retrieveBonusMax = advancedConfig.getRetrieveBonusMax(); private float retrieveBonusMax = advancedConfig.getRetrieveBonusMax();
private float retrieveMaxBonusLevel = advancedConfig.getRetrieveMaxBonusLevel(); private float retrieveMaxBonusLevel = advancedConfig.getRetrieveMaxBonusLevel();
public ArcheryManager (Player player) { public ArcheryManager (Player player) {
this.player = player; this.player = player;
this.profile = Users.getProfile(player); this.profile = Users.getProfile(player);
@ -57,7 +57,7 @@ public class ArcheryManager {
if (player.hasPermission("mcmmo.perks.lucky.archery")) { if (player.hasPermission("mcmmo.perks.lucky.archery")) {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (retrieveBonusMax / retrieveMaxBonusLevel) * skillLevel; final float chance = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * (double) skillLevel);
if (chance > Archery.getRandom().nextInt(randomChance)) { if (chance > Archery.getRandom().nextInt(randomChance)) {
eventHandler.addToTracker(); eventHandler.addToTracker();
} }
@ -88,10 +88,10 @@ public class ArcheryManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (dazeBonusMax / dazeMaxBonusLevel) * skillLevel; final float chance = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * (double) skillLevel);
if (chance > Archery.getRandom().nextInt(randomChance)) { if (chance > Archery.getRandom().nextInt(randomChance)) {
eventHandler.handleDazeEffect(); eventHandler.handleDazeEffect();
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();
} }
} }

View File

@ -21,7 +21,7 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
public class Axes { public class Axes {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private static Random random = new Random(); private static Random random = new Random();
@ -40,7 +40,7 @@ public class Axes {
final int INCREASE_LEVEL = MAX_LEVEL / MAX_BONUS; final int INCREASE_LEVEL = MAX_LEVEL / MAX_BONUS;
/* Add 1 DMG for every 50 skill levels */ /* Add 1 DMG for every 50 skill levels */
int bonus = Users.getProfile(attacker).getSkillLevel(SkillType.AXES) / INCREASE_LEVEL; int bonus = (int) ((double) Users.getProfile(attacker).getSkillLevel(SkillType.AXES) / (double) INCREASE_LEVEL);
if (bonus > MAX_BONUS) { if (bonus > MAX_BONUS) {
bonus = MAX_BONUS; bonus = MAX_BONUS;
@ -87,7 +87,7 @@ public class Axes {
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);
int randomChance = 100; int randomChance = 100;
double chance = (MAX_CHANCE / MAX_BONUS_LEVEL) * skillCheck; double chance = ((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillCheck;
if (attacker.hasPermission("mcmmo.perks.lucky.axes")) { if (attacker.hasPermission("mcmmo.perks.lucky.axes")) {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
@ -130,7 +130,7 @@ public class Axes {
/* Every 30 Skill Levels you gain 1 durability damage */ /* Every 30 Skill Levels you gain 1 durability damage */
int impactIncreaseLevel = advancedConfig.getGreaterImpactIncreaseLevel(); int impactIncreaseLevel = advancedConfig.getGreaterImpactIncreaseLevel();
durabilityDamage += Users.getProfile(attacker).getSkillLevel(SkillType.AXES)/impactIncreaseLevel; durabilityDamage += (int) ((double) Users.getProfile(attacker).getSkillLevel(SkillType.AXES) / (double) impactIncreaseLevel);
if (!hasArmor(targetPlayer)) { if (!hasArmor(targetPlayer)) {
applyGreaterImpact(attacker, target, event); applyGreaterImpact(attacker, target, event);
@ -158,7 +158,7 @@ public class Axes {
private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) { private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
if(attacker == null) if(attacker == null)
return; return;
final int GREATER_IMPACT_CHANCE = advancedConfig.getGreaterImpactChance(); final int GREATER_IMPACT_CHANCE = advancedConfig.getGreaterImpactChance();
final double GREATER_IMPACT_MULTIPLIER = advancedConfig.getGreaterImpactModifier(); final double GREATER_IMPACT_MULTIPLIER = advancedConfig.getGreaterImpactModifier();
final int GREATER_IMPACT_DAMAGE = advancedConfig.getGreaterImpactBonusDamage(); final int GREATER_IMPACT_DAMAGE = advancedConfig.getGreaterImpactBonusDamage();

View File

@ -28,18 +28,18 @@ import com.gmail.nossr50.util.Skills;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
public class BlastMining { public class BlastMining {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private static Random random = new Random(); private static Random random = new Random();
private static int blastMiningRank1 = advancedConfig.getBlastMiningRank1(); private static int blastMiningRank1 = advancedConfig.getBlastMiningRank1();
private static int blastMiningRank2 = advancedConfig.getBlastMiningRank2(); private static int blastMiningRank2 = advancedConfig.getBlastMiningRank2();
private static int blastMiningRank3 = advancedConfig.getBlastMiningRank3(); private static int blastMiningRank3 = advancedConfig.getBlastMiningRank3();
private static int blastMiningRank4 = advancedConfig.getBlastMiningRank4(); private static int blastMiningRank4 = advancedConfig.getBlastMiningRank4();
private static int blastMiningRank5 = advancedConfig.getBlastMiningRank5(); private static int blastMiningRank5 = advancedConfig.getBlastMiningRank5();
private static int blastMiningRank6 = advancedConfig.getBlastMiningRank6(); private static int blastMiningRank6 = advancedConfig.getBlastMiningRank6();
private static int blastMiningRank7 = advancedConfig.getBlastMiningRank7(); private static int blastMiningRank7 = advancedConfig.getBlastMiningRank7();
private static int blastMiningRank8 = advancedConfig.getBlastMiningRank8(); private static int blastMiningRank8 = advancedConfig.getBlastMiningRank8();
/** /**
* Handler for what blocks drop from the explosion. * Handler for what blocks drop from the explosion.
* *

View File

@ -27,7 +27,7 @@ import com.gmail.nossr50.util.Users;
public class Mining { public class Mining {
private static Random random = new Random(); private static Random random = new Random();
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
/** /**
* Handle double drops when using Silk Touch. * Handle double drops when using Silk Touch.
@ -323,7 +323,7 @@ public class Mining {
miningXP(player, block); miningXP(player, block);
final int MAX_BONUS_LEVEL = advancedConfig.getMiningDoubleDropMaxLevel(); final int MAX_BONUS_LEVEL = advancedConfig.getMiningDoubleDropMaxLevel();
int MAX_CHANCE = advancedConfig.getMiningDoubleDropChance(); int MAX_CHANCE = advancedConfig.getMiningDoubleDropChance();
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL); int skillCheck = Misc.skillCheck(skillLevel, MAX_BONUS_LEVEL);

View File

@ -32,7 +32,7 @@ import com.gmail.nossr50.util.Users;
public class WoodCutting { public class WoodCutting {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private static Random random = new Random(); private static Random random = new Random();
/** /**
@ -330,7 +330,7 @@ public class WoodCutting {
*/ */
private static void woodCuttingProcCheck(Player player, Block block) { private static void woodCuttingProcCheck(Player player, Block block) {
final int MAX_CHANCE = advancedConfig.getMiningDoubleDropChance(); final int MAX_CHANCE = advancedConfig.getMiningDoubleDropChance();
final int MAX_BONUS_LEVEL = advancedConfig.getMiningDoubleDropMaxLevel(); final int MAX_BONUS_LEVEL = advancedConfig.getMiningDoubleDropMaxLevel();
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.WOODCUTTING); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.WOODCUTTING);
@ -345,7 +345,7 @@ public class WoodCutting {
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
int randomChance = 100; int randomChance = 100;
int chance = (MAX_CHANCE / MAX_BONUS_LEVEL) * skillLevel; int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillLevel);
if (player.hasPermission("mcmmo.perks.lucky.woodcutting")) { if (player.hasPermission("mcmmo.perks.lucky.woodcutting")) {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);

View File

@ -28,12 +28,12 @@ public class Repair {
private static Config configInstance = Config.getInstance(); private static Config configInstance = Config.getInstance();
private static Permissions permInstance = Permissions.getInstance(); private static Permissions permInstance = Permissions.getInstance();
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
private static int repairMasteryChanceMax = advancedConfig.getRepairMasteryChanceMax(); private static int repairMasteryChanceMax = advancedConfig.getRepairMasteryChanceMax();
private static int repairMasteryMaxBonusLevel = advancedConfig.getRepairMasteryMaxLevel(); private static int repairMasteryMaxBonusLevel = advancedConfig.getRepairMasteryMaxLevel();
private static int superRepairChanceMax = advancedConfig.getSuperRepairChanceMax(); private static int superRepairChanceMax = advancedConfig.getSuperRepairChanceMax();
private static int superRepairMaxBonusLevel = advancedConfig.getSuperRepairMaxLevel(); private static int superRepairMaxBonusLevel = advancedConfig.getSuperRepairMaxLevel();
/** /**
* Handle the XP gain for repair events. * Handle the XP gain for repair events.
@ -211,9 +211,9 @@ public class Repair {
*/ */
protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) { protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) {
// float bonus = (float) skillLevel / 500; // float bonus = (float) skillLevel / 500;
float bonus; float bonus;
if(skillLevel >= repairMasteryMaxBonusLevel) bonus = repairMasteryChanceMax; if(skillLevel >= repairMasteryMaxBonusLevel) bonus = repairMasteryChanceMax;
else bonus = ((float) skillLevel / (float) repairMasteryMaxBonusLevel) * (float) repairMasteryChanceMax; else bonus = ((float) skillLevel / (float) repairMasteryMaxBonusLevel) * (float) repairMasteryChanceMax;
if (permInstance.repairMastery(player)) { if (permInstance.repairMastery(player)) {
bonus = (repairAmount * bonus); bonus = (repairAmount * bonus);
@ -240,20 +240,20 @@ public class Repair {
* @return true if bonus granted, false otherwise * @return true if bonus granted, false otherwise
*/ */
public static boolean checkPlayerProcRepair(Player player) { public static boolean checkPlayerProcRepair(Player player) {
final int MAX_CHANCE = superRepairChanceMax; final int MAX_CHANCE = superRepairChanceMax;
final int MAX_BONUS_LEVEL = superRepairMaxBonusLevel; final int MAX_BONUS_LEVEL = superRepairMaxBonusLevel;
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.REPAIR);
int randomChance = 100; int randomChance = 100;
int chance = (MAX_CHANCE / MAX_BONUS_LEVEL) * skillLevel; int chance = (int) (((double) MAX_CHANCE / (double) MAX_BONUS_LEVEL) * (double) skillLevel);
if (skillLevel >= MAX_BONUS_LEVEL) chance = MAX_CHANCE; if (skillLevel >= MAX_BONUS_LEVEL) chance = MAX_CHANCE;
if (player.hasPermission("mcmmo.perks.lucky.repair")) randomChance = (int) (randomChance * 0.75); if (player.hasPermission("mcmmo.perks.lucky.repair")) randomChance = (int) (randomChance * 0.75);
if (chance > random.nextInt(randomChance) && permInstance.repairBonus(player)){ if (chance > random.nextInt(randomChance) && permInstance.repairBonus(player)){
player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy")); player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
return true; return true;
} }
return false; return false;
} }

View File

@ -5,8 +5,8 @@ import java.util.Random;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
public class Swords { public class Swords {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
public static final int BLEED_MAX_BONUS_LEVEL = advancedConfig.getBleedMaxBonusLevel(); public static final int BLEED_MAX_BONUS_LEVEL = advancedConfig.getBleedMaxBonusLevel();
public static final int MAX_BLEED_TICKS = advancedConfig.getBleedMaxTicks(); public static final int MAX_BLEED_TICKS = advancedConfig.getBleedMaxTicks();
public static final int BASE_BLEED_TICKS = advancedConfig.getBleedBaseTicks(); public static final int BASE_BLEED_TICKS = advancedConfig.getBleedBaseTicks();

View File

@ -50,7 +50,7 @@ public class SwordsManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (bleedChanceMax / bleedMaxLevel) * skillLevel; final float chance = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * (double) skillLevel);
if (chance > Swords.getRandom().nextInt(randomChance)) { if (chance > Swords.getRandom().nextInt(randomChance)) {
eventHandler.addBleedTicks(); eventHandler.addBleedTicks();
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();
@ -81,7 +81,7 @@ public class SwordsManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (counterChanceMax / counterMaxLevel) * skillLevel; final float chance = (float) (((double) counterChanceMax / (double) counterMaxLevel) * (double) skillLevel);
if (chance > Swords.getRandom().nextInt(randomChance)) { if (chance > Swords.getRandom().nextInt(randomChance)) {
eventHandler.dealDamage(); eventHandler.dealDamage();
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();

View File

@ -5,8 +5,8 @@ import java.util.Random;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
public class Taming { public class Taming {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
public static final int ENVIRONMENTALLY_AWARE_ACTIVATION_LEVEL = advancedConfig.getEnviromentallyAwareUnlock(); public static final int ENVIRONMENTALLY_AWARE_ACTIVATION_LEVEL = advancedConfig.getEnviromentallyAwareUnlock();
public static final int FAST_FOOD_SERVICE_ACTIVATION_CHANCE = advancedConfig.getFastFoodChance(); public static final int FAST_FOOD_SERVICE_ACTIVATION_CHANCE = advancedConfig.getFastFoodChance();

View File

@ -111,7 +111,7 @@ public class TamingManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (goreChanceMax / goreMaxLevel) * skillLevel; final float chance = (float) (((double) goreChanceMax / (double) goreMaxLevel) * (double) skillLevel);
if (chance > Taming.getRandom().nextInt(randomChance)) { if (chance > Taming.getRandom().nextInt(randomChance)) {
eventHandler.modifyEventDamage(); eventHandler.modifyEventDamage();
eventHandler.applyBleed(); eventHandler.applyBleed();

View File

@ -5,8 +5,8 @@ import java.util.Random;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
public class Unarmed { public class Unarmed {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
public static final int BONUS_DAMAGE_MAX_BONUS_MODIFIER = advancedConfig.getIronArmBonus(); public static final int BONUS_DAMAGE_MAX_BONUS_MODIFIER = advancedConfig.getIronArmBonus();
public static final int BONUS_DAMAGE_INCREASE_LEVEL = advancedConfig.getIronArmIncreaseLevel(); public static final int BONUS_DAMAGE_INCREASE_LEVEL = advancedConfig.getIronArmIncreaseLevel();
public static final int DEFLECT_MAX_CHANCE = advancedConfig.getDisarmChanceMax() ; public static final int DEFLECT_MAX_CHANCE = advancedConfig.getDisarmChanceMax() ;

View File

@ -51,7 +51,7 @@ public class UnarmedManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (disarmChanceMax / disarmMaxLevel) * skillLevel; final float chance = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * (double) skillLevel);
if (chance > Unarmed.getRandom().nextInt(randomChance)) { if (chance > Unarmed.getRandom().nextInt(randomChance)) {
if (!hasIronGrip(defender)) { if (!hasIronGrip(defender)) {
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
@ -88,7 +88,7 @@ public class UnarmedManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (deflectChanceMax / deflectMaxLevel) * skillLevel; final float chance = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * (double) skillLevel);
if (chance > Unarmed.getRandom().nextInt(randomChance)) { if (chance > Unarmed.getRandom().nextInt(randomChance)) {
eventHandler.cancelEvent(); eventHandler.cancelEvent();
eventHandler.sendAbilityMessage(); eventHandler.sendAbilityMessage();
@ -144,7 +144,7 @@ public class UnarmedManager {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
final float chance = (ironGripChanceMax / ironGripMaxLevel) * skillLevel; final float chance = (float) (((double) ironGripChanceMax / (double) ironGripMaxLevel) * (double) skillLevel);
if (chance > Unarmed.getRandom().nextInt(randomChance)) { if (chance > Unarmed.getRandom().nextInt(randomChance)) {
eventHandler.sendAbilityMessages(); eventHandler.sendAbilityMessages();
return true; return true;