From fca130a8390c1cb4f8cc00a141a995fd26f21c43 Mon Sep 17 00:00:00 2001 From: Sobki Date: Sun, 15 Jan 2017 07:52:24 +1000 Subject: [PATCH] Add duration variable to EarthArmor (#694) --- .../configuration/ConfigManager.java | 1 + .../projectkorra/earthbending/EarthArmor.java | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java index f4c3b450..69920b4a 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java @@ -981,6 +981,7 @@ public class ConfigManager { config.addDefault("Abilities.Earth.EarthArmor.SelectRange", 10); config.addDefault("Abilities.Earth.EarthArmor.GoldHearts", 4); config.addDefault("Abilities.Earth.EarthArmor.Cooldown", 17500); + config.addDefault("Abilities.Earth.EarthArmor.MaxDuration", 20000); config.addDefault("Abilities.Earth.EarthBlast.Enabled", true); config.addDefault("Abilities.Earth.EarthBlast.CanHitSelf", false); diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java b/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java index bfa44374..94db0cf9 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java @@ -29,6 +29,7 @@ public class EarthArmor extends EarthAbility { private MaterialData legsData; private long cooldown; private long interval; + private long maxDuration; private double selectRange; private Block headBlock; private Block legsBlock; @@ -50,6 +51,7 @@ public class EarthArmor extends EarthAbility { this.interval = 2000; this.goldHearts = 0; this.cooldown = getConfig().getLong("Abilities.Earth.EarthArmor.Cooldown"); + this.maxDuration = getConfig().getLong("Abilities.Earth.EarthArmor.MaxDuration"); this.selectRange = getConfig().getDouble("Abilities.Earth.EarthArmor.SelectRange"); this.maxGoldHearts = getConfig().getInt("Abilities.Earth.EarthArmor.GoldHearts"); @@ -215,12 +217,27 @@ public class EarthArmor extends EarthAbility { return true; } + @SuppressWarnings("deprecation") @Override public void progress() { if (!bPlayer.canBendIgnoreBindsCooldowns(this)) { remove(); return; } + + if (System.currentTimeMillis() - getStartTime() > maxDuration) { + player.getLocation().getWorld().playSound(player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1); + player.getLocation().getWorld().playSound(player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1); + player.getLocation().getWorld().playSound(player.getLocation(), Sound.BLOCK_STONE_BREAK, 2, 1); + + ParticleEffect.BLOCK_CRACK.display(new ParticleEffect.BlockData(headData.getItemType(), headData.getData()), 0.1F, 0.1F, 0.1F, 1, 32, player.getEyeLocation(), 128); + ParticleEffect.BLOCK_CRACK.display(new ParticleEffect.BlockData(legsData.getItemType(), legsData.getData()), 0.1F, 0.1F, 0.1F, 1, 32, player.getLocation(), 128); + + bPlayer.addCooldown(this); + remove(); + remove(); + return; + } if (formed) { //PassiveHandler.checkArmorPassives(player);