From 487e67d20828d40069929e93748fbae2bdb2f798 Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Thu, 10 Jan 2013 23:15:53 -0500 Subject: [PATCH] Because NuclearW said I was wrong... "Final is final unless it's not really final." --- .../nossr50/skills/acrobatics/Acrobatics.java | 20 +++++++++---------- .../skills/acrobatics/AcrobaticsManager.java | 16 +++++++-------- .../skills/acrobatics/DodgeEventHandler.java | 2 +- .../skills/acrobatics/RollEventHandler.java | 2 +- .../gmail/nossr50/skills/archery/Archery.java | 17 ++++++++-------- .../ArcheryBonusDamageEventHandler.java | 6 +++--- .../skills/archery/ArcheryManager.java | 6 +++--- .../archery/ArrowTrackingEventHandler.java | 2 +- .../skills/archery/DazeEventHandler.java | 4 ++-- .../nossr50/skills/archery/TrackedEntity.java | 2 +- 10 files changed, 36 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java index aa0889ddb..0f1f72efc 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/Acrobatics.java @@ -3,17 +3,15 @@ package com.gmail.nossr50.skills.acrobatics; import com.gmail.nossr50.config.AdvancedConfig; public class Acrobatics { - private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); + public static int maxDodgeChance = AdvancedConfig.getInstance().getDodgeChanceMax(); + public static int maxDodgeBonusLevel = AdvancedConfig.getInstance().getDodgeMaxBonusLevel(); + public static int dodgeXpModifier = AdvancedConfig.getInstance().getDodgeXPModifier(); - public static final int DODGE_MAX_CHANCE = advancedConfig.getDodgeChanceMax(); - public static final int DODGE_MAX_BONUS_LEVEL = advancedConfig.getDodgeMaxBonusLevel(); - public static final int DODGE_XP_MODIFIER = advancedConfig.getDodgeXPModifier(); + public static int maxRollChance = AdvancedConfig.getInstance().getRollChanceMax(); + public static int maxRollBonusLevel = AdvancedConfig.getInstance().getRollMaxBonusLevel(); + public static int maxGracefulRollChance = AdvancedConfig.getInstance().getGracefulRollChanceMax(); + public static int maxGracefulRollBonusLevel = AdvancedConfig.getInstance().getGracefulRollMaxBonusLevel(); - public static final int ROLL_MAX_CHANCE = advancedConfig.getRollChanceMax(); - public static final int ROLL_MAX_BONUS_LEVEL = advancedConfig.getRollMaxBonusLevel(); - public static final int GRACEFUL_MAX_CHANCE = advancedConfig.getGracefulRollChanceMax(); - public static final int GRACEFUL_MAX_BONUS_LEVEL = advancedConfig.getGracefulRollMaxBonusLevel(); - - public static final int ROLL_XP_MODIFIER = advancedConfig.getRollXPModifier(); - public static final int FALL_XP_MODIFIER = advancedConfig.getFallXPModifier(); + public static int rollXpModifier = AdvancedConfig.getInstance().getRollXPModifier(); + public static int fallXpModifier = AdvancedConfig.getInstance().getFallXPModifier(); } diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java index d0b081f63..24113b890 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/AcrobaticsManager.java @@ -10,8 +10,6 @@ import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; public class AcrobaticsManager extends SkillManager { - private static Config config = Config.getInstance(); - public AcrobaticsManager (Player player) { super(player, SkillType.ACROBATICS); } @@ -26,7 +24,7 @@ public class AcrobaticsManager extends SkillManager { return; } - if (config.getAcrobaticsAFKDisabled() && player.isInsideVehicle()) { + if (Config.getInstance().getAcrobaticsAFKDisabled() && player.isInsideVehicle()) { return; } @@ -40,19 +38,19 @@ public class AcrobaticsManager extends SkillManager { float chance; if (eventHandler.isGraceful) { - chance = ((float) Acrobatics.GRACEFUL_MAX_CHANCE / Acrobatics.GRACEFUL_MAX_BONUS_LEVEL) * eventHandler.skillModifier; + chance = ((float) Acrobatics.maxGracefulRollChance / Acrobatics.maxGracefulRollBonusLevel) * eventHandler.skillModifier; } else { - chance = ((float) Acrobatics.ROLL_MAX_CHANCE / Acrobatics.ROLL_MAX_BONUS_LEVEL) * eventHandler.skillModifier; + chance = ((float) Acrobatics.maxRollChance / Acrobatics.maxRollBonusLevel) * eventHandler.skillModifier; } if (chance > Misc.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) { eventHandler.modifyEventDamage(); eventHandler.sendAbilityMessage(); - eventHandler.processXPGain(eventHandler.damage * Acrobatics.ROLL_XP_MODIFIER); + eventHandler.processXPGain(eventHandler.damage * Acrobatics.rollXpModifier); } else if (!eventHandler.isFatal(event.getDamage())) { - eventHandler.processXPGain(eventHandler.damage * Acrobatics.FALL_XP_MODIFIER); + eventHandler.processXPGain(eventHandler.damage * Acrobatics.fallXpModifier); } } @@ -73,12 +71,12 @@ public class AcrobaticsManager extends SkillManager { randomChance = (int) (randomChance * 0.75); } - float chance = ((float) Acrobatics.DODGE_MAX_CHANCE / Acrobatics.DODGE_MAX_BONUS_LEVEL) * eventHandler.skillModifier; + float chance = ((float) Acrobatics.maxDodgeChance / Acrobatics.maxDodgeBonusLevel) * eventHandler.skillModifier; if (chance > Misc.getRandom().nextInt(randomChance) && !eventHandler.isFatal(eventHandler.modifiedDamage)) { eventHandler.modifyEventDamage(); eventHandler.sendAbilityMessage(); - eventHandler.processXPGain(eventHandler.damage * Acrobatics.DODGE_XP_MODIFIER); + eventHandler.processXPGain(eventHandler.damage * Acrobatics.dodgeXpModifier); } } } diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/DodgeEventHandler.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/DodgeEventHandler.java index 64f28adb4..fb7af69e6 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/DodgeEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/DodgeEventHandler.java @@ -18,7 +18,7 @@ public class DodgeEventHandler extends AcrobaticsEventHandler { @Override protected void calculateSkillModifier() { - this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Acrobatics.DODGE_MAX_BONUS_LEVEL); + this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Acrobatics.maxDodgeBonusLevel); } @Override diff --git a/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java b/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java index f55650c03..c0f2c33d8 100644 --- a/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/acrobatics/RollEventHandler.java @@ -29,7 +29,7 @@ public class RollEventHandler extends AcrobaticsEventHandler { skillModifer = skillModifer * 2; } - skillModifer = Misc.skillCheck(skillModifer, Acrobatics.ROLL_MAX_BONUS_LEVEL); + skillModifer = Misc.skillCheck(skillModifer, Acrobatics.maxRollBonusLevel); this.skillModifier = skillModifer; } diff --git a/src/main/java/com/gmail/nossr50/skills/archery/Archery.java b/src/main/java/com/gmail/nossr50/skills/archery/Archery.java index 274238419..738144085 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/Archery.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/Archery.java @@ -12,19 +12,18 @@ import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.util.Misc; public class Archery { - private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance(); private static List trackedEntities = new ArrayList(); - public static final int ARROW_TRACKING_MAX_BONUS_LEVEL = advancedConfig.getRetrieveMaxBonusLevel(); - public static final int ARROW_TRACKING_MAX_BONUS = advancedConfig.getRetrieveBonusMax(); + public static int arrowTrackingMaxBonusLevel = AdvancedConfig.getInstance().getRetrieveMaxBonusLevel(); + public static int arrowTrackingMaxBonus = AdvancedConfig.getInstance().getRetrieveBonusMax(); - public static final int BONUS_DAMAGE_INCREASE_LEVEL = advancedConfig.getSkillShotIncreaseLevel(); - public static final double BONUS_DAMAGE_INCREASE_PERCENT = advancedConfig.getSkillShotIncreasePercentage(); - public static final double BONUS_DAMAGE_MAX_BONUS_PERCENTAGE = advancedConfig.getSkillShotBonusMax(); + public static int skillShotIncreaseLevel = AdvancedConfig.getInstance().getSkillShotIncreaseLevel(); + public static double skillShotIncreasePercentage = AdvancedConfig.getInstance().getSkillShotIncreasePercentage(); + public static double skillShotMaxBonusPercentage = AdvancedConfig.getInstance().getSkillShotBonusMax(); - public static final int DAZE_MAX_BONUS_LEVEL = advancedConfig.getDazeMaxBonusLevel(); - public static final int DAZE_MAX_BONUS = advancedConfig.getDazeBonusMax(); - public static final int DAZE_MODIFIER = advancedConfig.getDazeModifier(); + public static int dazeMaxBonusLevel = AdvancedConfig.getInstance().getDazeMaxBonusLevel(); + public static int dazeMaxBonus = AdvancedConfig.getInstance().getDazeBonusMax(); + public static int dazeModifier = AdvancedConfig.getInstance().getDazeModifier(); protected static void incrementTrackerValue(LivingEntity livingEntity) { for (TrackedEntity trackedEntity : trackedEntities) { diff --git a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryBonusDamageEventHandler.java b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryBonusDamageEventHandler.java index dba5c88e0..2d9d47449 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryBonusDamageEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryBonusDamageEventHandler.java @@ -14,10 +14,10 @@ public class ArcheryBonusDamageEventHandler { } protected void calculateDamageBonus() { - this.damageBonusPercent = ((manager.getSkillLevel() / Archery.BONUS_DAMAGE_INCREASE_LEVEL) * Archery.BONUS_DAMAGE_INCREASE_PERCENT); + this.damageBonusPercent = ((manager.getSkillLevel() / Archery.skillShotIncreaseLevel) * Archery.skillShotIncreasePercentage); - if (damageBonusPercent > Archery.BONUS_DAMAGE_MAX_BONUS_PERCENTAGE) { - damageBonusPercent = Archery.BONUS_DAMAGE_MAX_BONUS_PERCENTAGE; + if (damageBonusPercent > Archery.skillShotMaxBonusPercentage) { + damageBonusPercent = Archery.skillShotMaxBonusPercentage; } } diff --git a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java index db3620451..61cae2d42 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java @@ -31,7 +31,7 @@ public class ArcheryManager extends SkillManager { randomChance = (int) (randomChance * 0.75); } - float chance = ((float) Archery.ARROW_TRACKING_MAX_BONUS / Archery.ARROW_TRACKING_MAX_BONUS_LEVEL) * eventHandler.skillModifier; + float chance = ((float) Archery.arrowTrackingMaxBonus / Archery.arrowTrackingMaxBonusLevel) * eventHandler.skillModifier; if (chance > Misc.getRandom().nextInt(randomChance)) { eventHandler.addToTracker(); @@ -56,7 +56,7 @@ public class ArcheryManager extends SkillManager { randomChance = (int) (randomChance * 0.75); } - float chance = ((float) Archery.DAZE_MAX_BONUS / Archery.DAZE_MAX_BONUS_LEVEL) * eventHandler.skillModifier; + float chance = ((float) Archery.dazeMaxBonus / Archery.dazeMaxBonusLevel) * eventHandler.skillModifier; if (chance > Misc.getRandom().nextInt(randomChance)) { eventHandler.handleDazeEffect(); @@ -74,7 +74,7 @@ public class ArcheryManager extends SkillManager { return; } - if (skillLevel >= Archery.BONUS_DAMAGE_INCREASE_LEVEL) { + if (skillLevel >= Archery.skillShotIncreaseLevel) { ArcheryBonusDamageEventHandler eventHandler = new ArcheryBonusDamageEventHandler(this, event); eventHandler.calculateDamageBonus(); diff --git a/src/main/java/com/gmail/nossr50/skills/archery/ArrowTrackingEventHandler.java b/src/main/java/com/gmail/nossr50/skills/archery/ArrowTrackingEventHandler.java index 1b3bd7892..2d6839b96 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/ArrowTrackingEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/ArrowTrackingEventHandler.java @@ -18,7 +18,7 @@ public class ArrowTrackingEventHandler { } protected void calculateSkillModifier() { - this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Archery.ARROW_TRACKING_MAX_BONUS_LEVEL); + this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Archery.arrowTrackingMaxBonusLevel); } protected void addToTracker() { diff --git a/src/main/java/com/gmail/nossr50/skills/archery/DazeEventHandler.java b/src/main/java/com/gmail/nossr50/skills/archery/DazeEventHandler.java index bc1774fdb..167694581 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/DazeEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/DazeEventHandler.java @@ -25,7 +25,7 @@ public class DazeEventHandler { } protected void calculateSkillModifier() { - this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Archery.DAZE_MAX_BONUS_LEVEL); + this.skillModifier = Misc.skillCheck(manager.getSkillLevel(), Archery.dazeMaxBonusLevel); } protected void handleDazeEffect() { @@ -39,7 +39,7 @@ public class DazeEventHandler { } defender.teleport(location); - event.setDamage(event.getDamage() + Archery.DAZE_MODIFIER); + event.setDamage(event.getDamage() + Archery.dazeModifier); } protected void sendAbilityMessages() { diff --git a/src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java b/src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java index 57d93d294..b59e6584d 100644 --- a/src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java +++ b/src/main/java/com/gmail/nossr50/skills/archery/TrackedEntity.java @@ -48,7 +48,7 @@ public class TrackedEntity implements Runnable { public void run() { if (!isActive()) { Archery.removeFromTracker(this); - scheduler.cancelTask(taskId); + scheduler.cancelTask(taskId); } } }