RaiseEarth works on gravel, Illumination only works in darkness (#570)

This commit is contained in:
Sobki 2016-09-03 11:21:47 +10:00 committed by OmniCypher
parent f8e5f0a861
commit 195bed14ee
3 changed files with 25 additions and 10 deletions

View file

@ -477,6 +477,8 @@ public abstract class EarthAbility extends ElementalAbility {
} else { } else {
target.setType(Material.SANDSTONE); target.setType(Material.SANDSTONE);
} }
} else if (info.getState().getType() == Material.GRAVEL) {
target.setType(Material.STONE);
} else { } else {
target.setType(info.getState().getType()); target.setType(info.getState().getType());
target.setData(info.getState().getRawData()); target.setData(info.getState().getRawData());

View file

@ -1028,6 +1028,7 @@ public class ConfigManager {
config.addDefault("Abilities.Fire.Illumination.Enabled", true); config.addDefault("Abilities.Fire.Illumination.Enabled", true);
config.addDefault("Abilities.Fire.Illumination.Range", 5); config.addDefault("Abilities.Fire.Illumination.Range", 5);
config.addDefault("Abilities.Fire.Illumination.Cooldown", 500); config.addDefault("Abilities.Fire.Illumination.Cooldown", 500);
config.addDefault("Abilities.Fire.Illumination.LightThreshold", 7);
config.addDefault("Abilities.Fire.Lightning.Enabled", true); config.addDefault("Abilities.Fire.Lightning.Enabled", true);
config.addDefault("Abilities.Fire.Lightning.Damage", 4.0); config.addDefault("Abilities.Fire.Lightning.Damage", 4.0);

View file

@ -19,12 +19,19 @@ public class Illumination extends FireAbility {
private byte normalData; private byte normalData;
private long cooldown; private long cooldown;
private double range; private double range;
private int lightThreshold;
private Material normalType; private Material normalType;
private Block block; private Block block;
private int oldLevel;
public Illumination(Player player) { public Illumination(Player player) {
super(player); super(player);
this.range = getConfig().getDouble("Abilities.Fire.Illumination.Range");
this.cooldown = getConfig().getLong("Abilities.Fire.Illumination.Cooldown");
this.range = getDayFactor(this.range);
this.lightThreshold = getConfig().getInt("Abilities.Fire.Illumination.LightThreshold");
Illumination oldIllum = getAbility(player, Illumination.class); Illumination oldIllum = getAbility(player, Illumination.class);
if (oldIllum != null) { if (oldIllum != null) {
oldIllum.remove(); oldIllum.remove();
@ -36,18 +43,17 @@ public class Illumination extends FireAbility {
return; return;
} }
this.range = getConfig().getDouble("Abilities.Fire.Illumination.Range");
this.cooldown = getConfig().getLong("Abilities.Fire.Illumination.Cooldown");
this.range = getDayFactor(this.range);
if (bPlayer.isOnCooldown(this)) { if (bPlayer.isOnCooldown(this)) {
return; return;
} }
if (player.getLocation().getBlock().getLightLevel() < this.lightThreshold) {
oldLevel = player.getLocation().getBlock().getLightLevel();
bPlayer.addCooldown(this);
set(); set();
start(); start();
bPlayer.addCooldown(this); }
} }
@Override @Override
@ -62,6 +68,11 @@ public class Illumination extends FireAbility {
return; return;
} }
if (oldLevel > this.lightThreshold) {
remove();
return;
}
set(); set();
} }
@ -77,6 +88,7 @@ public class Illumination extends FireAbility {
BLOCKS.remove(block); BLOCKS.remove(block);
block.setType(normalType); block.setType(normalType);
block.setData(normalData); block.setData(normalData);
oldLevel = player.getLocation().getBlock().getLightLevel();
} }
} }