mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 03:30:10 +00:00
Add Duration to AvatarState
This commit is contained in:
parent
aaa20d6a58
commit
3b75d8f36f
5 changed files with 23 additions and 1 deletions
Binary file not shown.
|
@ -17,6 +17,7 @@ import com.projectkorra.ProjectKorra.ProjectKorra;
|
|||
public class AvatarState {
|
||||
|
||||
public static ConcurrentHashMap<Player, AvatarState> instances = new ConcurrentHashMap<Player, AvatarState>();
|
||||
public static ConcurrentHashMap<String, Long> startTimes = new ConcurrentHashMap<String, Long>();
|
||||
public static Map<String, Long> cooldowns = new HashMap<String, Long>();
|
||||
|
||||
public static FileConfiguration config = ProjectKorra.plugin.getConfig();
|
||||
|
@ -29,6 +30,7 @@ public class AvatarState {
|
|||
private static int resistancePower = config.getInt("Abilities.AvatarState.PotionEffects.DamageResistance.Power") - 1;
|
||||
private static boolean fireResistanceEnabled = config.getBoolean("Abilities.AvatarState.PotionEffects.FireResistance.Enabled");
|
||||
private static int fireResistancePower = config.getInt("Abilities.AvatarState.PotionEffects.FireResistance.Power") - 1;
|
||||
private static long duration = config.getLong("Abilities.AvatarState.Duration");
|
||||
|
||||
private static final double factor = 5;
|
||||
|
||||
|
@ -40,6 +42,9 @@ public class AvatarState {
|
|||
this.player = player;
|
||||
if (instances.containsKey(player)) {
|
||||
instances.remove(player);
|
||||
if (startTimes.containsKey(player.getName())) {
|
||||
startTimes.remove(player.getName());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (cooldowns.containsKey(player.getName())) {
|
||||
|
@ -54,6 +59,9 @@ public class AvatarState {
|
|||
if (cooldown != 0) {
|
||||
cooldowns.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
if (duration != 0) {
|
||||
startTimes.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
public static void manageAvatarStates() {
|
||||
|
@ -69,8 +77,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());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (startTimes.containsKey(player.getName())) {
|
||||
if (startTimes.get(player.getName()) + duration >= System.currentTimeMillis()) {
|
||||
startTimes.remove(player.getName());
|
||||
instances.remove(player);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
addPotionEffects();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -80,6 +80,8 @@ public class ConfigManager {
|
|||
+ "are incredibly amplified in this state. Additionally, AirShield and FireJet become toggle-able "
|
||||
+ "abilities and last until you deactivate them or the Avatar State. Click again with the Avatar "
|
||||
+ "State selected to deactivate it.");
|
||||
config.addDefault("Abilities.AvatarState.Cooldown", 7200000);
|
||||
config.addDefault("Abilities.AvatarState.Duration", 480000);
|
||||
config.addDefault("Abilities.AvatarState.PotionEffects.Regeneration.Enabled", true);
|
||||
config.addDefault("Abilities.AvatarState.PotionEffects.Regeneration.Power", 3);
|
||||
config.addDefault("Abilities.AvatarState.PotionEffects.Speed.Enabled", true);
|
||||
|
|
|
@ -59,6 +59,7 @@ Abilities:
|
|||
Enabled: true
|
||||
Description: "The signature ability of the Avatar, this is a toggle. Click to activate to become nearly unstoppable. While in the Avatar State, the user takes severely reduced damage from all sources, regenreates health rapidly, and is granted extreme speed. Nearly all abilities are incredibly amplified in this state. Additionally, AirShield and FireJet become toggle-able abilities and last until you deactivate them or the Avatar State. Click again with the Avatar State selected to deactivate it."
|
||||
Cooldown: 720000
|
||||
Duration: 480000
|
||||
PotionEffects:
|
||||
Regeneration:
|
||||
Enabled: true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: ProjectKorra
|
||||
author: ProjectKorra
|
||||
version: 1.2.0 BETA 3
|
||||
version: 1.2.0 BETA 4
|
||||
main: com.projectkorra.ProjectKorra.ProjectKorra
|
||||
commands:
|
||||
projectkorra:
|
||||
|
|
Loading…
Reference in a new issue