diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 6298354d3..aba9d00e7 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -45,6 +45,7 @@ import com.gmail.nossr50.skills.repair.RepairableManagerFactory; import com.gmail.nossr50.skills.repair.config.RepairConfigManager; import com.gmail.nossr50.util.ChimaeraWing; import com.gmail.nossr50.util.LogFilter; +import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.UpdateChecker; import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManager; @@ -352,23 +353,23 @@ public class mcMMO extends JavaPlugin { new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks); // Bleed timer (Runs every two seconds) - new BleedTimerTask().runTaskTimer(this, 40, 40); + new BleedTimerTask().runTaskTimer(this, 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR); // Old & Powerless User remover - long purgeIntervalTicks = Config.getInstance().getPurgeInterval() * 60 * 60 * 20; + long purgeIntervalTicks = Config.getInstance().getPurgeInterval() * 60 * 60 * Misc.TICK_CONVERSION_FACTOR; if (purgeIntervalTicks == 0) { - new UserPurgeTask().runTaskLater(this, 40); // Start 2 seconds after startup. + new UserPurgeTask().runTaskLater(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup. } else if (purgeIntervalTicks > 0) { new UserPurgeTask().runTaskTimer(this, purgeIntervalTicks, purgeIntervalTicks); } // Automatically remove old members from parties - long kickIntervalTicks = Config.getInstance().getAutoPartyKickInterval() * 60 * 60 * 20; + long kickIntervalTicks = Config.getInstance().getAutoPartyKickInterval() * 60 * 60 * Misc.TICK_CONVERSION_FACTOR; if (kickIntervalTicks == 0) { - new PartyAutoKickTask().runTaskLater(this, 40); // Start 2 seconds after startup. + new PartyAutoKickTask().runTaskLater(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup. } else if (kickIntervalTicks > 0) { new PartyAutoKickTask().runTaskTimer(this, kickIntervalTicks, kickIntervalTicks); diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java index 1fc630f2e..2c65ede0f 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java @@ -60,6 +60,6 @@ public class AbilityDisableTask extends BukkitRunnable { } SkillUtils.sendSkillMessage(player, ability.getAbilityPlayerOff(player)); - new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLaterAsynchronously(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * 20); + new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLaterAsynchronously(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR); } } diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index 423da1118..220a86c38 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -122,7 +122,7 @@ public class FishingManager extends SkillManager { kraken.setCustomName(AdvancedConfig.getInstance().getKrakenName()); if (!kraken.isValid()) { - int attackInterval = AdvancedConfig.getInstance().getKrakenAttackInterval() * 20; + int attackInterval = AdvancedConfig.getInstance().getKrakenAttackInterval() * Misc.TICK_CONVERSION_FACTOR; new KrakenAttackTask(kraken, player, player.getLocation()).runTaskTimer(mcMMO.p, attackInterval, attackInterval); if (!forceSpawn) { @@ -135,7 +135,7 @@ public class FishingManager extends SkillManager { kraken.setMaxHealth(AdvancedConfig.getInstance().getKrakenHealth()); kraken.setHealth(kraken.getMaxHealth()); - int attackInterval = AdvancedConfig.getInstance().getKrakenAttackInterval() * 20; + int attackInterval = AdvancedConfig.getInstance().getKrakenAttackInterval() * Misc.TICK_CONVERSION_FACTOR; new KrakenAttackTask(kraken, player).runTaskTimer(mcMMO.p, attackInterval, attackInterval); if (!forceSpawn) { diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java index fe84be382..ac792f616 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java @@ -109,7 +109,7 @@ public class MiningManager extends SkillManager { getProfile().setSkillDATS(AbilityType.BLAST_MINING, System.currentTimeMillis()); mcMMOPlayer.setAbilityInformed(AbilityType.BLAST_MINING, false); - new AbilityCooldownTask(mcMMOPlayer, AbilityType.BLAST_MINING).runTaskLaterAsynchronously(mcMMO.p, AbilityType.BLAST_MINING.getCooldown() * 20); + new AbilityCooldownTask(mcMMOPlayer, AbilityType.BLAST_MINING).runTaskLaterAsynchronously(mcMMO.p, AbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR); } /** diff --git a/src/main/java/com/gmail/nossr50/util/Misc.java b/src/main/java/com/gmail/nossr50/util/Misc.java index 6602de8bc..fd6b7daa4 100644 --- a/src/main/java/com/gmail/nossr50/util/Misc.java +++ b/src/main/java/com/gmail/nossr50/util/Misc.java @@ -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 diff --git a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java index 6a3110d28..c1c00f6fd 100644 --- a/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java +++ b/src/main/java/com/gmail/nossr50/util/MobHealthbarUtils.java @@ -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 } } diff --git a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java index 3d5c8ad15..d47c1c3b1 100644 --- a/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java +++ b/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java @@ -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); } } diff --git a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java index 8e998a55e..58785f35f 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/SkillUtils.java @@ -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);