From b2d8d562ade403c52e54da6e75d1e1c74c823740 Mon Sep 17 00:00:00 2001 From: MistPhizzle Date: Thu, 17 Jul 2014 23:44:31 -0400 Subject: [PATCH] Fix AvatarState not starting --- .../ProjectKorra/Ability/AvatarState.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/com/projectkorra/ProjectKorra/Ability/AvatarState.java b/src/com/projectkorra/ProjectKorra/Ability/AvatarState.java index 09f319e5..00337667 100644 --- a/src/com/projectkorra/ProjectKorra/Ability/AvatarState.java +++ b/src/com/projectkorra/ProjectKorra/Ability/AvatarState.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; @@ -17,8 +18,8 @@ import com.projectkorra.ProjectKorra.ProjectKorra; public class AvatarState { public static ConcurrentHashMap instances = new ConcurrentHashMap(); - public static ConcurrentHashMap startTimes = new ConcurrentHashMap(); public static Map cooldowns = new HashMap(); + public static Map startTimes = new HashMap(); public static FileConfiguration config = ProjectKorra.plugin.getConfig(); private static final long cooldown = ProjectKorra.plugin.getConfig().getLong("Abilities.AvatarState.Cooldown"); @@ -42,8 +43,8 @@ public class AvatarState { this.player = player; if (instances.containsKey(player)) { instances.remove(player); - if (startTimes.containsKey(player.getName())) { - startTimes.remove(player.getName()); + if (cooldowns.containsKey(player.getName())) { + cooldowns.remove(player.getName()); } return; } @@ -77,19 +78,19 @@ public class AvatarState { private boolean progress() { if (!Methods.canBend(player.getName(), StockAbilities.AvatarState.name())) { instances.remove(player); - if (startTimes.containsKey(player.getName())) { - startTimes.remove(player.getName()); + if (cooldowns.containsKey(player.getName())) { + cooldowns.remove(player.getName()); } return false; } if (startTimes.containsKey(player.getName())) { - if (startTimes.get(player.getName()) + duration >= System.currentTimeMillis()) { + if (startTimes.get(player.getName()) + duration < System.currentTimeMillis()) { startTimes.remove(player.getName()); instances.remove(player); - return false; } } + addPotionEffects(); return true; }