Skip to content
Browse files

Use finals rather than local variables.

  • Loading branch information...
1 parent 1ff1704 commit 3194baffd7644bdfa2f43fe995b0b9d9da10b59e @gmcferrin gmcferrin committed Jan 1, 2013
View
2 src/main/java/com/gmail/nossr50/skills/archery/Archery.java
@@ -18,12 +18,14 @@
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
public static final int ARROW_TRACKING_MAX_BONUS_LEVEL = advancedConfig.getRetrieveMaxBonusLevel();
+ public static final int ARROW_TRACKING_MAX_BONUS = advancedConfig.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 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();
protected static void incrementTrackerValue(LivingEntity livingEntity) {
View
12 src/main/java/com/gmail/nossr50/skills/archery/ArcheryManager.java
@@ -4,25 +4,17 @@
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent;
-import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
public class ArcheryManager {
- AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
-
private Player player;
private PlayerProfile profile;
private int skillLevel;
private Permissions permissionsInstance;
- private float dazeBonusMax = advancedConfig.getDazeBonusMax();
- private float dazeMaxBonusLevel = advancedConfig.getDazeMaxBonusLevel();
- private float retrieveBonusMax = advancedConfig.getRetrieveBonusMax();
- private float retrieveMaxBonusLevel = advancedConfig.getRetrieveMaxBonusLevel();
-
public ArcheryManager (Player player) {
this.player = player;
this.profile = Users.getProfile(player);
@@ -57,7 +49,7 @@ public void trackArrows(LivingEntity livingEntity) {
if (player.hasPermission("mcmmo.perks.lucky.archery")) {
randomChance = (int) (randomChance * 0.75);
}
- final float chance = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillLevel);
+ final float chance = (float) (((double) Archery.ARROW_TRACKING_MAX_BONUS / (double) Archery.ARROW_TRACKING_MAX_BONUS_LEVEL) * skillLevel);
if (chance > Archery.getRandom().nextInt(randomChance)) {
eventHandler.addToTracker();
}
@@ -88,7 +80,7 @@ public void dazeCheck(Player defender, EntityDamageEvent event) {
randomChance = (int) (randomChance * 0.75);
}
- final float chance = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillLevel);
+ final float chance = (float) (((double) Archery.DAZE_MAX_BONUS / (double) Archery.DAZE_MAX_BONUS_LEVEL) * skillLevel);
if (chance > Archery.getRandom().nextInt(randomChance)) {
eventHandler.handleDazeEffect();
eventHandler.sendAbilityMessages();

0 comments on commit 3194baf

Please sign in to comment.
Something went wrong with that request. Please try again.