Less magic numbers.

This commit is contained in:
GJ
2013-06-12 19:26:09 -04:00
parent 965dbda101
commit 050be563bf
8 changed files with 20 additions and 15 deletions

View File

@ -28,8 +28,11 @@ import com.gmail.nossr50.util.spout.SpoutUtils;
public final class Misc {
private static Random random = new Random();
public static final int PLAYER_RESPAWN_COOLDOWN_SECONDS = 5;
public static final int TIME_CONVERSION_FACTOR = 1000;
public static final int TICK_CONVERSION_FACTOR = 20;
public static final int PLAYER_RESPAWN_COOLDOWN_SECONDS = 5;
public static final double SKILL_MESSAGE_MAX_SENDING_DISTANCE = 10.0;
// Sound Pitches & Volumes from CB

View File

@ -83,7 +83,7 @@ public final class MobHealthbarUtils {
target.setMetadata(mcMMO.customVisibleKey, new FixedMetadataValue(mcMMO.p, false));
}
new MobHealthDisplayUpdaterTask(target).runTaskLater(mcMMO.p, displayTime * 20); // Clear health display after 3 seconds
new MobHealthDisplayUpdaterTask(target).runTaskLater(mcMMO.p, displayTime * Misc.TICK_CONVERSION_FACTOR); // Clear health display after 3 seconds
}
}

View File

@ -19,6 +19,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.runnables.scoreboards.ScoreboardChangeTask;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils;
@ -309,7 +310,7 @@ public class ScoreboardManager {
enablePowerLevelDisplay(player);
if (displayTime != -1 && !SCOREBOARD_TASKS.contains(playerName)) {
new ScoreboardChangeTask(player, oldScoreboard).runTaskLater(mcMMO.p, displayTime * 20);
new ScoreboardChangeTask(player, oldScoreboard).runTaskLater(mcMMO.p, displayTime * Misc.TICK_CONVERSION_FACTOR);
SCOREBOARD_TASKS.add(playerName);
}
}

View File

@ -119,7 +119,7 @@ public class SkillUtils {
mcMMOPlayer.setToolPreparationATS(tool, System.currentTimeMillis());
mcMMOPlayer.setToolPreparationMode(tool, true);
new ToolLowerTask(mcMMOPlayer, tool).runTaskLaterAsynchronously(mcMMO.p, 4 * 20);
new ToolLowerTask(mcMMOPlayer, tool).runTaskLaterAsynchronously(mcMMO.p, 4 * Misc.TICK_CONVERSION_FACTOR);
}
}
@ -300,7 +300,7 @@ public class SkillUtils {
handleAbilitySpeedIncrease(player);
}
new AbilityDisableTask(mcMMOPlayer, ability).runTaskLater(mcMMO.p, ticks * 20);
new AbilityDisableTask(mcMMOPlayer, ability).runTaskLater(mcMMO.p, ticks * Misc.TICK_CONVERSION_FACTOR);
}
}
@ -393,7 +393,7 @@ public class SkillUtils {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
SkillType skill = mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER) ? SkillType.MINING : SkillType.EXCAVATION;
int ticks = PerksUtils.handleActivationPerks(player, 2 + (mcMMOPlayer.getProfile().getSkillLevel(skill) / AdvancedConfig.getInstance().getAbilityLength()), skill.getAbility().getMaxTicks()) * 20;
int ticks = PerksUtils.handleActivationPerks(player, 2 + (mcMMOPlayer.getProfile().getSkillLevel(skill) / AdvancedConfig.getInstance().getAbilityLength()), skill.getAbility().getMaxTicks()) * Misc.TICK_CONVERSION_FACTOR;
PotionEffect abilityBuff = new PotionEffect(PotionEffectType.FAST_DIGGING, duration + ticks, amplifier + 10);
player.addPotionEffect(abilityBuff, true);