mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
RaiseEarth works on gravel, Illumination only works in darkness (#570)
This commit is contained in:
parent
f8e5f0a861
commit
195bed14ee
3 changed files with 25 additions and 10 deletions
|
@ -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());
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
set();
|
if (player.getLocation().getBlock().getLightLevel() < this.lightThreshold) {
|
||||||
start();
|
oldLevel = player.getLocation().getBlock().getLightLevel();
|
||||||
bPlayer.addCooldown(this);
|
bPlayer.addCooldown(this);
|
||||||
|
set();
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +100,7 @@ public class Illumination extends FireAbility {
|
||||||
if (standBlock.getType() == Material.GLOWSTONE) {
|
if (standBlock.getType() == Material.GLOWSTONE) {
|
||||||
revert();
|
revert();
|
||||||
} else if ((BlazeArc.isIgnitable(player, standingBlock)
|
} else if ((BlazeArc.isIgnitable(player, standingBlock)
|
||||||
&& standBlock.getType() != Material.LEAVES && standBlock .getType() != Material.LEAVES_2)
|
&& standBlock.getType() != Material.LEAVES && standBlock.getType() != Material.LEAVES_2)
|
||||||
&& block == null && !BLOCKS.containsKey(standBlock)) {
|
&& block == null && !BLOCKS.containsKey(standBlock)) {
|
||||||
block = standingBlock;
|
block = standingBlock;
|
||||||
normalType = block.getType();
|
normalType = block.getType();
|
||||||
|
@ -97,7 +109,7 @@ public class Illumination extends FireAbility {
|
||||||
block.setType(Material.TORCH);
|
block.setType(Material.TORCH);
|
||||||
BLOCKS.put(block, player);
|
BLOCKS.put(block, player);
|
||||||
} else if ((BlazeArc.isIgnitable(player, standingBlock)
|
} else if ((BlazeArc.isIgnitable(player, standingBlock)
|
||||||
&& standBlock.getType() != Material.LEAVES && standBlock .getType() != Material.LEAVES_2)
|
&& standBlock.getType() != Material.LEAVES && standBlock.getType() != Material.LEAVES_2)
|
||||||
&& !block.equals(standBlock)
|
&& !block.equals(standBlock)
|
||||||
&& !BLOCKS.containsKey(standBlock)
|
&& !BLOCKS.containsKey(standBlock)
|
||||||
&& GeneralMethods.isSolid(standBlock)) {
|
&& GeneralMethods.isSolid(standBlock)) {
|
||||||
|
|
Loading…
Reference in a new issue