Remove config caching from SkillTools.java

This commit is contained in:
GJ 2013-02-22 13:53:16 -05:00
parent 0d473d232e
commit 9282b7bd15
4 changed files with 6 additions and 10 deletions

View File

@ -335,7 +335,7 @@ public class PlayerListener implements Listener {
/* ACTIVATION & ITEM CHECKS */
if (BlockChecks.canActivateAbilities(blockState)) {
if (SkillTools.abilitiesEnabled) {
if (Config.getInstance().getAbilitiesEnabled()) {
if (BlockChecks.canActivateHerbalism(blockState)) {
SkillTools.activationCheck(player, SkillType.HERBALISM);
}
@ -365,7 +365,7 @@ public class PlayerListener implements Listener {
case RIGHT_CLICK_AIR:
/* ACTIVATION CHECKS */
if (SkillTools.abilitiesEnabled) {
if (Config.getInstance().getAbilitiesEnabled()) {
SkillTools.activationCheck(player, SkillType.AXES);
SkillTools.activationCheck(player, SkillType.EXCAVATION);
SkillTools.activationCheck(player, SkillType.HERBALISM);

View File

@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.commands.CommandHelper;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.utilities.PerksUtils;
@ -125,7 +126,7 @@ public abstract class SkillCommand implements CommandExecutor {
protected String[] calculateLengthDisplayValues() {
int maxLength = skill.getAbility().getMaxTicks();
int length = 2 + (int) (skillValue / SkillTools.abilityLengthIncreaseLevel);
int length = 2 + (int) (skillValue / AdvancedConfig.getInstance().getAbilityLength());
int enduranceLength = PerksUtils.handleActivationPerks(player, length, maxLength);
if (maxLength != 0) {

View File

@ -37,11 +37,6 @@ import com.gmail.nossr50.util.StringUtils;
import com.gmail.nossr50.util.Users;
public class SkillTools {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
public static boolean abilitiesEnabled = Config.getInstance().getAbilitiesEnabled();
public static int toolDurabilityLoss = Config.getInstance().getAbilityToolDamage();
public static int abilityLengthIncreaseLevel = AdvancedConfig.getInstance().getAbilityLength();
public static void handleFoodSkills(Player player, SkillType skill, FoodLevelChangeEvent event, int baseLevel, int maxLevel, int rankChange) {
int skillLevel = Users.getPlayer(player).getProfile().getSkillLevel(skill);
@ -391,7 +386,7 @@ public class SkillTools {
}
if (!profile.getAbilityMode(ability) && cooldownOver(profile.getSkillDATS(ability), ability.getCooldown(), player)) {
int ticks = PerksUtils.handleActivationPerks(player, 2 + (profile.getSkillLevel(type) / abilityLengthIncreaseLevel), ability.getMaxTicks());
int ticks = PerksUtils.handleActivationPerks(player, 2 + (profile.getSkillLevel(type) / AdvancedConfig.getInstance().getAbilityLength()), ability.getMaxTicks());
ParticleEffectUtils.playAbilityEnabledEffect(player);

View File

@ -143,7 +143,7 @@ public final class TreeFeller {
for (BlockState blockState : treeFellerBlocks) {
if (BlockChecks.isLog(blockState) && Misc.getRandom().nextInt(unbreakingLevel + 1) == 0) {
durabilityLoss += SkillTools.toolDurabilityLoss;
durabilityLoss += Config.getInstance().getAbilityToolDamage();
}
}