Add duration variable to EarthArmor (#694)

This commit is contained in:
Sobki 2017-01-15 07:52:24 +10:00 committed by Christopher Martin
parent 134def0f1d
commit fca130a839
2 changed files with 18 additions and 0 deletions

View file

@ -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);

View file

@ -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);