mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
Port earth abilities to new configuration system, tweak combo configuration handling, and remove LavaSurge
This commit is contained in:
parent
e756d3904f
commit
d690b369c5
56 changed files with 925 additions and 1725 deletions
|
@ -132,7 +132,6 @@ import com.projectkorra.projectkorra.earthbending.Tremorsense;
|
||||||
import com.projectkorra.projectkorra.earthbending.combo.EarthPillars;
|
import com.projectkorra.projectkorra.earthbending.combo.EarthPillars;
|
||||||
import com.projectkorra.projectkorra.earthbending.lava.LavaFlow;
|
import com.projectkorra.projectkorra.earthbending.lava.LavaFlow;
|
||||||
import com.projectkorra.projectkorra.earthbending.lava.LavaFlow.AbilityType;
|
import com.projectkorra.projectkorra.earthbending.lava.LavaFlow.AbilityType;
|
||||||
import com.projectkorra.projectkorra.earthbending.lava.LavaSurge;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.metal.Extraction;
|
import com.projectkorra.projectkorra.earthbending.metal.Extraction;
|
||||||
import com.projectkorra.projectkorra.earthbending.metal.MetalClips;
|
import com.projectkorra.projectkorra.earthbending.metal.MetalClips;
|
||||||
import com.projectkorra.projectkorra.earthbending.passive.DensityShift;
|
import com.projectkorra.projectkorra.earthbending.passive.DensityShift;
|
||||||
|
@ -285,9 +284,7 @@ public class PKListener implements Listener {
|
||||||
if (TempBlock.isTempBlock(fromblock) || TempBlock.isTempBlock(toblock)) {
|
if (TempBlock.isTempBlock(fromblock) || TempBlock.isTempBlock(toblock)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else {
|
} else {
|
||||||
if (ElementalAbility.isLava(fromblock)) {
|
if (ElementalAbility.isWater(fromblock)) {
|
||||||
event.setCancelled(!EarthPassive.canFlowFromTo(fromblock, toblock));
|
|
||||||
} else if (ElementalAbility.isWater(fromblock)) {
|
|
||||||
event.setCancelled(WaterBubble.isAir(toblock));
|
event.setCancelled(WaterBubble.isAir(toblock));
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
event.setCancelled(!WaterManipulation.canFlowFromTo(fromblock, toblock));
|
event.setCancelled(!WaterManipulation.canFlowFromTo(fromblock, toblock));
|
||||||
|
@ -466,13 +463,6 @@ public class PKListener implements Listener {
|
||||||
if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
|
if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getEntityType() == EntityType.FALLING_BLOCK) {
|
|
||||||
if (LavaSurge.getAllFallingBlocks().contains(entity)) {
|
|
||||||
LavaSurge.getAllFallingBlocks().remove(entity);
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
|
@ -1724,11 +1714,6 @@ public class PKListener implements Listener {
|
||||||
} else if (clips.getMetalClipsCount() == 4 && clips.isCanUse4Clips()) {
|
} else if (clips.getMetalClipsCount() == 4 && clips.isCanUse4Clips()) {
|
||||||
clips.crush();
|
clips.crush();
|
||||||
}
|
}
|
||||||
} else if (abil.equalsIgnoreCase("LavaSurge")) {
|
|
||||||
final LavaSurge surge = CoreAbility.getAbility(player, LavaSurge.class);
|
|
||||||
if (surge != null) {
|
|
||||||
surge.launch();
|
|
||||||
}
|
|
||||||
} else if (abil.equalsIgnoreCase("LavaFlow")) {
|
} else if (abil.equalsIgnoreCase("LavaFlow")) {
|
||||||
new LavaFlow(player, AbilityType.CLICK);
|
new LavaFlow(player, AbilityType.CLICK);
|
||||||
} else if (abil.equalsIgnoreCase("EarthSmash")) {
|
} else if (abil.equalsIgnoreCase("EarthSmash")) {
|
||||||
|
|
|
@ -7,9 +7,12 @@ import org.bukkit.entity.Player;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
||||||
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
public interface ComboAbility<C extends AbilityConfig> {
|
public interface ComboAbility {
|
||||||
|
|
||||||
public abstract Object createNewComboInstance(C config, Player player);
|
/**
|
||||||
|
* Creates a new instance of this combo type with default config
|
||||||
|
*/
|
||||||
|
public abstract Object createNewComboInstance(Player player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of abilities which constitute the combo.
|
* Returns the list of abilities which constitute the combo.
|
||||||
|
|
|
@ -15,10 +15,11 @@ import com.projectkorra.projectkorra.ability.ComboAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.configuration.better.configs.abilities.air.AirStreamConfig;
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.air.AirStreamConfig;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
|
|
||||||
public class AirStream extends AirAbility<AirStreamConfig> implements ComboAbility<AirStreamConfig> {
|
public class AirStream extends AirAbility<AirStreamConfig> implements ComboAbility {
|
||||||
|
|
||||||
@Attribute(Attribute.COOLDOWN)
|
@Attribute(Attribute.COOLDOWN)
|
||||||
private long cooldown;
|
private long cooldown;
|
||||||
|
@ -200,8 +201,8 @@ public class AirStream extends AirAbility<AirStreamConfig> implements ComboAbili
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object createNewComboInstance(final AirStreamConfig config, final Player player) {
|
public Object createNewComboInstance(final Player player) {
|
||||||
return new AirStream(config, player);
|
return new AirStream(ConfigManager.getConfig(AirStreamConfig.class), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,12 +18,13 @@ import com.projectkorra.projectkorra.ability.util.Collision;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.configuration.better.configs.abilities.air.AirSweepConfig;
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.air.AirSweepConfig;
|
||||||
import com.projectkorra.projectkorra.firebending.combo.FireComboStream;
|
import com.projectkorra.projectkorra.firebending.combo.FireComboStream;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||||
|
|
||||||
public class AirSweep extends AirAbility<AirSweepConfig> implements ComboAbility<AirSweepConfig> {
|
public class AirSweep extends AirAbility<AirSweepConfig> implements ComboAbility {
|
||||||
|
|
||||||
private int progressCounter;
|
private int progressCounter;
|
||||||
@Attribute(Attribute.COOLDOWN)
|
@Attribute(Attribute.COOLDOWN)
|
||||||
|
@ -242,8 +243,8 @@ public class AirSweep extends AirAbility<AirSweepConfig> implements ComboAbility
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object createNewComboInstance(final AirSweepConfig config, final Player player) {
|
public Object createNewComboInstance(final Player player) {
|
||||||
return new AirSweep(config, player);
|
return new AirSweep(ConfigManager.getConfig(AirSweepConfig.class), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,10 +14,11 @@ import com.projectkorra.projectkorra.ability.ComboAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.configuration.better.configs.abilities.air.TwisterConfig;
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.air.TwisterConfig;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
|
|
||||||
public class Twister extends AirAbility<TwisterConfig> implements ComboAbility<TwisterConfig> {
|
public class Twister extends AirAbility<TwisterConfig> implements ComboAbility {
|
||||||
|
|
||||||
public static enum AbilityState {
|
public static enum AbilityState {
|
||||||
TWISTER_MOVING, TWISTER_STATIONARY
|
TWISTER_MOVING, TWISTER_STATIONARY
|
||||||
|
@ -180,8 +181,8 @@ public class Twister extends AirAbility<TwisterConfig> implements ComboAbility<T
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object createNewComboInstance(final TwisterConfig config, final Player player) {
|
public Object createNewComboInstance(final Player player) {
|
||||||
return new Twister(config, player);
|
return new Twister(ConfigManager.getConfig(TwisterConfig.class), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,11 +15,12 @@ import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.configuration.better.configs.abilities.chi.ImmobilizeConfig;
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.chi.ImmobilizeConfig;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
import com.projectkorra.projectkorra.util.MovementHandler;
|
import com.projectkorra.projectkorra.util.MovementHandler;
|
||||||
|
|
||||||
public class Immobilize extends ChiAbility<ImmobilizeConfig> implements ComboAbility<ImmobilizeConfig> {
|
public class Immobilize extends ChiAbility<ImmobilizeConfig> implements ComboAbility {
|
||||||
|
|
||||||
@Attribute(Attribute.DURATION)
|
@Attribute(Attribute.DURATION)
|
||||||
private long duration;
|
private long duration;
|
||||||
|
@ -89,8 +90,8 @@ public class Immobilize extends ChiAbility<ImmobilizeConfig> implements ComboAbi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object createNewComboInstance(final ImmobilizeConfig config, final Player player) {
|
public Object createNewComboInstance(final Player player) {
|
||||||
return new Immobilize(config, player);
|
return new Immobilize(ConfigManager.getConfig(ImmobilizeConfig.class), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
|
||||||
|
|
||||||
public class AirBlastConfig extends AbilityConfig {
|
public class AirBlastConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
public final int AnimationParticleAmount = 0;
|
public final int AnimationParticleAmount = 0;
|
||||||
public final int SelectionParticleAmount = 0;
|
public final int SelectionParticleAmount = 0;
|
||||||
public final double PushFactor_Self = 0;
|
public final double PushFactor_Self = 0;
|
||||||
|
@ -12,7 +13,6 @@ public class AirBlastConfig extends AbilityConfig {
|
||||||
public final double Range = 0;
|
public final double Range = 0;
|
||||||
public final double SelectionRange = 0;
|
public final double SelectionRange = 0;
|
||||||
public final double Radius = 0;
|
public final double Radius = 0;
|
||||||
public final long Cooldown = 0;
|
|
||||||
|
|
||||||
public final boolean CanFlickLevers = true;
|
public final boolean CanFlickLevers = true;
|
||||||
public final boolean CanOpenDoors = true;
|
public final boolean CanOpenDoors = true;
|
||||||
|
|
|
@ -4,11 +4,11 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
|
||||||
|
|
||||||
public class AirBurstConfig extends AbilityConfig {
|
public class AirBurstConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
public final long ChargeTime = 0;
|
public final long ChargeTime = 0;
|
||||||
public final double FallHeightThreshold = 0;
|
public final double FallHeightThreshold = 0;
|
||||||
public final double PushFactor = 0;
|
public final double PushFactor = 0;
|
||||||
public final double Damage = 0;
|
public final double Damage = 0;
|
||||||
public final long Cooldown = 0;
|
|
||||||
public final double AnglePhi = 0;
|
public final double AnglePhi = 0;
|
||||||
public final double AngleTheta = 0;
|
public final double AngleTheta = 0;
|
||||||
public final int ChargeParticles = 0;
|
public final int ChargeParticles = 0;
|
||||||
|
|
|
@ -4,11 +4,11 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
|
||||||
|
|
||||||
public class AirScooterConfig extends AbilityConfig {
|
public class AirScooterConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
public final double Speed = 0;
|
public final double Speed = 0;
|
||||||
public final double Interval = 0;
|
public final double Interval = 0;
|
||||||
public final double Radius = 0;
|
public final double Radius = 0;
|
||||||
public final long Duration = 0;
|
public final long Duration = 0;
|
||||||
public final long Cooldown = 0;
|
|
||||||
public final double MaxHeightFromGround = 0;
|
public final double MaxHeightFromGround = 0;
|
||||||
public final boolean ShowSitting = true;
|
public final boolean ShowSitting = true;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class CatapultConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final double StageTimeMult = 0;
|
||||||
|
public final boolean CancelWithAngle = true;
|
||||||
|
public final double Angle = 0;
|
||||||
|
|
||||||
|
public final long AvatarState_Cooldown = 0;
|
||||||
|
|
||||||
|
public CatapultConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Catapult";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class CollapseConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final int SelectRange = 0;
|
||||||
|
public final double Speed = 0;
|
||||||
|
|
||||||
|
public final ColumnConfig ColumnConfig = new ColumnConfig();
|
||||||
|
|
||||||
|
public final WallConfig WallConfig = new WallConfig();
|
||||||
|
|
||||||
|
public static class ColumnConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final int Height = 0;
|
||||||
|
|
||||||
|
public final int AvatarState_Height = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class WallConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final int Height = 0;
|
||||||
|
public final double Radius = 0;
|
||||||
|
|
||||||
|
public final int AvatarState_Height = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public CollapseConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Collapse";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class DensityShiftConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Duration = 0;
|
||||||
|
|
||||||
|
public DensityShiftConfig() {
|
||||||
|
super(true, "", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "DensityShift";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Water", "Passives" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class EarthArmorConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final long MaxDuration = 0;
|
||||||
|
public final double SelectRange = 0;
|
||||||
|
public final int GoldHearts = 0;
|
||||||
|
|
||||||
|
public final long AvatarState_Cooldown = 0;
|
||||||
|
public final int AvatarState_GoldHearts = 0;
|
||||||
|
|
||||||
|
public EarthArmorConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "EarthArmor";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class EarthBlastConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final double DeflectRange = 0;
|
||||||
|
public final double CollisionRadius = 0;
|
||||||
|
public final double Range = 0;
|
||||||
|
public final double Damage = 0;
|
||||||
|
public final double Speed = 0;
|
||||||
|
public final boolean CanHitSelf = true;
|
||||||
|
public final double PushFactor = 0;
|
||||||
|
public final double SelectRange = 0;
|
||||||
|
|
||||||
|
public final long AvatarState_Cooldown = 0;
|
||||||
|
public final double AvatarState_Damage = 0;
|
||||||
|
|
||||||
|
public EarthBlastConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "EarthBlast";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,6 +4,11 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
|
||||||
|
|
||||||
public class EarthDomeConfig extends AbilityConfig {
|
public class EarthDomeConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final int Height = 0;
|
||||||
|
public final double Radius = 0;
|
||||||
|
public final double Range = 0;
|
||||||
|
|
||||||
public EarthDomeConfig() {
|
public EarthDomeConfig() {
|
||||||
super(true, "", "");
|
super(true, "", "");
|
||||||
}
|
}
|
||||||
|
@ -15,7 +20,7 @@ public class EarthDomeConfig extends AbilityConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getParents() {
|
public String[] getParents() {
|
||||||
return new String[] { "Abilities", "Earth" };
|
return new String[] { "Abilities", "Earth", "Combos" };
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class EarthGrabConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final double Range = 0;
|
||||||
|
public final double DragSpeed = 0;
|
||||||
|
public final double DamageThreshold = 0;
|
||||||
|
public final double TrapHP = 0;
|
||||||
|
public final long TrapHitInterval = 0;
|
||||||
|
|
||||||
|
public EarthGrabConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "EarthGrab";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class EarthPillarsConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final double Radius = 0;
|
||||||
|
public final double Knockup = 0;
|
||||||
|
public final double Damage = 0;
|
||||||
|
public final boolean DealsDamage = true;
|
||||||
|
public final double FallHeightThreshold = 0;
|
||||||
|
|
||||||
|
public EarthPillarsConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "EarthPillars";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth", "Combos" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class EarthSmashConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final long ChargeTime = 0;
|
||||||
|
public final long Duration = 0;
|
||||||
|
public final int RequiredBendableBlocks = 0;
|
||||||
|
public final int MaxBlocksToPassThrough = 0;
|
||||||
|
public final double Damage = 0;
|
||||||
|
public final double Knockback = 0;
|
||||||
|
public final double Knockup = 0;
|
||||||
|
public final double SelectRange = 0;
|
||||||
|
public final long LiftAnimationInterval = 0;
|
||||||
|
public final double ShootRange = 0;
|
||||||
|
public final long ShootAnimationInterval = 0;
|
||||||
|
|
||||||
|
public final long AvatarState_Cooldown = 0;
|
||||||
|
public final long AvatarState_ChargeTime = 0;
|
||||||
|
public final double AvatarState_SelectRange = 0;
|
||||||
|
public final double AvatarState_Damage = 0;
|
||||||
|
public final double AvatarState_Knockback = 0;
|
||||||
|
public final double AvatarState_ShootRange = 0;
|
||||||
|
|
||||||
|
public final FlightConfig FlightConfig = new FlightConfig();
|
||||||
|
|
||||||
|
public final GrabConfig GrabConfig = new GrabConfig();
|
||||||
|
|
||||||
|
public static class FlightConfig {
|
||||||
|
|
||||||
|
public final boolean Enabled = true;
|
||||||
|
|
||||||
|
public final double Speed = 0;
|
||||||
|
public final long Duration = 0;
|
||||||
|
public final long AnimationInterval = 0;
|
||||||
|
public final double DetectionRadius = 0;
|
||||||
|
|
||||||
|
public final double AvatarState_Speed = 0;
|
||||||
|
public final long AvatarState_Duration = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class GrabConfig {
|
||||||
|
|
||||||
|
public final boolean Enabled = true;
|
||||||
|
|
||||||
|
public final double Range = 0;
|
||||||
|
public final double DetectionRadius = 0;
|
||||||
|
|
||||||
|
public final double AvatarState_Range = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public EarthSmashConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "EarthSmash";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class EarthTunnelConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final long Interval = 0;
|
||||||
|
public final double MaxRadius = 0;
|
||||||
|
public final double Range = 0;
|
||||||
|
public final double InitialRadius = 0;
|
||||||
|
public final int BlocksPerInterval = 0;
|
||||||
|
public final boolean Revert = true;
|
||||||
|
public final long RevertCheckTime = 0;
|
||||||
|
public final boolean DropLootIfNotRevert = true;
|
||||||
|
public final boolean IgnoreOres = true;
|
||||||
|
|
||||||
|
public final double AvatarState_MaxRadius = 0;
|
||||||
|
|
||||||
|
public EarthTunnelConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "EarthTunnel";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class ExtractionConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final int SelectRange = 0;
|
||||||
|
public final int DoubleLootChance = 0;
|
||||||
|
public final int TripleLootChance = 0;
|
||||||
|
|
||||||
|
public ExtractionConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Extraction";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class FerroControlConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public FerroControlConfig() {
|
||||||
|
super(true, "", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "FerroControl";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth", "Passives" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class LavaFlowConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long ShiftCooldown = 0;
|
||||||
|
public final long ClickLavaCooldown = 0;
|
||||||
|
public final long ClickLandCooldown = 0;
|
||||||
|
public final Material RevertMaterial = Material.STONE;
|
||||||
|
public final double ShiftPlatformRadius = 0;
|
||||||
|
public final double ShiftRadius = 0;
|
||||||
|
public final double ShiftFlowSpeed = 0;
|
||||||
|
public final double ShiftRemoveSpeed = 0;
|
||||||
|
public final long ShiftCleanupDelay = 0;
|
||||||
|
public final double ParticleDensity = 0;
|
||||||
|
public final double ClickRange = 0;
|
||||||
|
public final double ClickRadius = 0;
|
||||||
|
public final long ClickLavaStartDelay = 0;
|
||||||
|
public final long ClickLandStartDelay = 0;
|
||||||
|
public final long ClickLavaCleanupDelay = 0;
|
||||||
|
public final long ClickLandCleanupDelay = 0;
|
||||||
|
public final double ClickLavaCreateSpeed = 0;
|
||||||
|
public final double ClickLandCreateSpeed = 0;
|
||||||
|
public final int UpwardFlow = 0;
|
||||||
|
public final int DownwardFlow = 0;
|
||||||
|
public final boolean AllowNaturalFlow = true;
|
||||||
|
|
||||||
|
public final long AvatarState_ShiftCooldown = 0;
|
||||||
|
public final long AvatarState_ClickLavaCooldown = 0;
|
||||||
|
public final long AvatarState_ClickLandCooldown = 0;
|
||||||
|
public final double AvatarState_ShiftPlatformRadius = 0;
|
||||||
|
public final double AvatarState_ShiftRadius = 0;
|
||||||
|
public final double AvatarState_ClickRadius = 0;
|
||||||
|
|
||||||
|
public LavaFlowConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "LavaFlow";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class MetalClipsConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final long Duration = 0;
|
||||||
|
public final double Range = 0;
|
||||||
|
public final double Damage = 0;
|
||||||
|
public final boolean ThrowEnabled = true;
|
||||||
|
|
||||||
|
public final long AvatarState_Cooldown = 0;
|
||||||
|
public final double AvatarState_Range = 0;
|
||||||
|
|
||||||
|
public final CrushConfig CrushConfig = new CrushConfig();
|
||||||
|
|
||||||
|
public final MagnetConfig MagnetConfig = new MagnetConfig();
|
||||||
|
|
||||||
|
public static class CrushConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final double Damage = 0;
|
||||||
|
|
||||||
|
public final double AvatarState_Damage = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MagnetConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final double Range = 0;
|
||||||
|
public final double Speed = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public MetalClipsConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "MetalClips";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class RaiseEarthConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final ColumnConfig ColumnConfig = new ColumnConfig();
|
||||||
|
|
||||||
|
public final WallConfig WallConfig = new WallConfig();
|
||||||
|
|
||||||
|
public static class ColumnConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final int Height = 0;
|
||||||
|
public final double Speed = 0;
|
||||||
|
public final double SelectRange = 0;
|
||||||
|
|
||||||
|
public final int AvatarState_Height = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class WallConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final int Height = 0;
|
||||||
|
public final int Width = 0;
|
||||||
|
public final int SelectRange = 0;
|
||||||
|
|
||||||
|
public final int AvatarState_Height = 0;
|
||||||
|
public final int AvatarState_Width = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public RaiseEarthConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "RaiseEarth";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class ShockwaveConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final long ChargeTime = 0;
|
||||||
|
public final double FallThreshold = 0;
|
||||||
|
public final double Range = 0;
|
||||||
|
public final double Damage = 0;
|
||||||
|
public final double Knockback = 0;
|
||||||
|
public final double Angle = 0;
|
||||||
|
|
||||||
|
public final long AvatarState_Cooldown = 0;
|
||||||
|
public final long AvatarState_ChargeTime = 0;
|
||||||
|
public final double AvatarState_Range = 0;
|
||||||
|
public final double AvatarState_Damage = 0;
|
||||||
|
public final double AvatarState_Knockback = 0;
|
||||||
|
|
||||||
|
public ShockwaveConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Shockwave";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.projectkorra.projectkorra.configuration.better.configs.abilities.earth;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
|
||||||
|
|
||||||
|
public class TremorsenseConfig extends AbilityConfig {
|
||||||
|
|
||||||
|
public final long Cooldown = 0;
|
||||||
|
public final byte LightThreshold = 0;
|
||||||
|
public final int MaxDepth = 0;
|
||||||
|
public final int StickyRange = 0;
|
||||||
|
public final int Radius = 0;
|
||||||
|
|
||||||
|
public TremorsenseConfig() {
|
||||||
|
super(true, "", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Tremorsense";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParents() {
|
||||||
|
return new String[] { "Abilities", "Earth" };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -14,9 +14,10 @@ import org.bukkit.util.Vector;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.CatapultConfig;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||||
|
|
||||||
public class Catapult extends EarthAbility {
|
public class Catapult extends EarthAbility<CatapultConfig> {
|
||||||
|
|
||||||
private double stageTimeMult;
|
private double stageTimeMult;
|
||||||
@Attribute(Attribute.COOLDOWN)
|
@Attribute(Attribute.COOLDOWN)
|
||||||
|
@ -33,8 +34,8 @@ public class Catapult extends EarthAbility {
|
||||||
private boolean cancelWithAngle;
|
private boolean cancelWithAngle;
|
||||||
private BlockData bentBlockData;
|
private BlockData bentBlockData;
|
||||||
|
|
||||||
public Catapult(final Player player, final boolean sneak) {
|
public Catapult(final CatapultConfig config, final Player player, final boolean sneak) {
|
||||||
super(player);
|
super(config, player);
|
||||||
this.setFields();
|
this.setFields();
|
||||||
final Block b = player.getLocation().getBlock().getRelative(BlockFace.DOWN, 1);
|
final Block b = player.getLocation().getBlock().getRelative(BlockFace.DOWN, 1);
|
||||||
if (!(isEarth(b) || isSand(b) || isMetal(b))) {
|
if (!(isEarth(b) || isSand(b) || isMetal(b))) {
|
||||||
|
@ -48,7 +49,7 @@ public class Catapult extends EarthAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.Catapult.Cooldown");
|
this.cooldown = config.AvatarState_Cooldown;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.charging = sneak;
|
this.charging = sneak;
|
||||||
|
@ -56,10 +57,10 @@ public class Catapult extends EarthAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setFields() {
|
private void setFields() {
|
||||||
this.stageTimeMult = getConfig().getDouble("Abilities.Earth.Catapult.StageTimeMult");
|
this.stageTimeMult = config.StageTimeMult;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.Catapult.Cooldown");
|
this.cooldown = config.Cooldown;
|
||||||
this.angle = Math.toRadians(getConfig().getDouble("Abilities.Earth.Catapult.Angle"));
|
this.angle = Math.toRadians(config.Angle);
|
||||||
this.cancelWithAngle = getConfig().getBoolean("Abilities.Earth.Catapult.CancelWithAngle");
|
this.cancelWithAngle = config.CancelWithAngle;
|
||||||
this.activationHandled = false;
|
this.activationHandled = false;
|
||||||
this.stage = 1;
|
this.stage = 1;
|
||||||
this.stageStart = System.currentTimeMillis();
|
this.stageStart = System.currentTimeMillis();
|
||||||
|
|
|
@ -12,10 +12,11 @@ import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.CollapseConfig;
|
||||||
import com.projectkorra.projectkorra.util.BlockSource;
|
import com.projectkorra.projectkorra.util.BlockSource;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
|
|
||||||
public class Collapse extends EarthAbility {
|
public class Collapse extends EarthAbility<CollapseConfig> {
|
||||||
|
|
||||||
private int distance;
|
private int distance;
|
||||||
@Attribute(Attribute.HEIGHT)
|
@Attribute(Attribute.HEIGHT)
|
||||||
|
@ -33,8 +34,8 @@ public class Collapse extends EarthAbility {
|
||||||
private Block block;
|
private Block block;
|
||||||
private Map<Block, Block> affectedBlocks;
|
private Map<Block, Block> affectedBlocks;
|
||||||
|
|
||||||
public Collapse(final Player player) {
|
public Collapse(final CollapseConfig config, final Player player) {
|
||||||
super(player);
|
super(config, player);
|
||||||
this.setFields();
|
this.setFields();
|
||||||
|
|
||||||
if (!this.bPlayer.canBend(this) || this.bPlayer.isOnCooldown("CollapsePillar")) {
|
if (!this.bPlayer.canBend(this) || this.bPlayer.isOnCooldown("CollapsePillar")) {
|
||||||
|
@ -52,7 +53,7 @@ public class Collapse extends EarthAbility {
|
||||||
this.loadAffectedBlocks();
|
this.loadAffectedBlocks();
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.height = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.Collapse.Column.Height");
|
this.height = config.ColumnConfig.AvatarState_Height;
|
||||||
}
|
}
|
||||||
if (this.distance != 0) {
|
if (this.distance != 0) {
|
||||||
this.start();
|
this.start();
|
||||||
|
@ -63,8 +64,8 @@ public class Collapse extends EarthAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collapse(final Player player, final Location origin) {
|
public Collapse(final CollapseConfig config, final Player player, final Location origin) {
|
||||||
super(player);
|
super(config, player);
|
||||||
this.setFields();
|
this.setFields();
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
@ -82,10 +83,10 @@ public class Collapse extends EarthAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setFields() {
|
private void setFields() {
|
||||||
this.height = this.bPlayer.isAvatarState() ? getConfig().getInt("Abilities.Avatar.AvatarState.Earth.Collapse.Column.Height") : getConfig().getInt("Abilities.Earth.Collapse.Column.Height");
|
this.height = this.bPlayer.isAvatarState() ? config.ColumnConfig.AvatarState_Height : config.ColumnConfig.Height;
|
||||||
this.selectRange = getConfig().getInt("Abilities.Earth.Collapse.SelectRange");
|
this.selectRange = config.SelectRange;
|
||||||
this.speed = getConfig().getDouble("Abilities.Earth.Collapse.Speed");
|
this.speed = config.Speed;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.Collapse.Column.Cooldown");
|
this.cooldown = config.ColumnConfig.Cooldown;
|
||||||
this.direction = new Vector(0, -1, 0);
|
this.direction = new Vector(0, -1, 0);
|
||||||
this.affectedBlocks = new ConcurrentHashMap<>();
|
this.affectedBlocks = new ConcurrentHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,11 @@ import org.bukkit.entity.Player;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.CollapseConfig;
|
||||||
import com.projectkorra.projectkorra.util.BlockSource;
|
import com.projectkorra.projectkorra.util.BlockSource;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
|
|
||||||
public class CollapseWall extends EarthAbility {
|
public class CollapseWall extends EarthAbility<CollapseConfig> {
|
||||||
|
|
||||||
@Attribute(Attribute.SELECT_RANGE)
|
@Attribute(Attribute.SELECT_RANGE)
|
||||||
private int selectRange;
|
private int selectRange;
|
||||||
|
@ -29,22 +30,22 @@ public class CollapseWall extends EarthAbility {
|
||||||
private Map<Block, Block> blocks;
|
private Map<Block, Block> blocks;
|
||||||
private Map<Block, Integer> baseBlocks;
|
private Map<Block, Integer> baseBlocks;
|
||||||
|
|
||||||
public CollapseWall(final Player player) {
|
public CollapseWall(final CollapseConfig config, final Player player) {
|
||||||
super(player);
|
super(config, player);
|
||||||
|
|
||||||
if (!this.bPlayer.canBend(this) || this.bPlayer.isOnCooldown("CollapseWall")) {
|
if (!this.bPlayer.canBend(this) || this.bPlayer.isOnCooldown("CollapseWall")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectRange = getConfig().getInt("Abilities.Earth.Collapse.SelectRange");
|
this.selectRange = config.SelectRange;
|
||||||
this.height = getConfig().getInt("Abilities.Earth.Collapse.Wall.Height");
|
this.height = config.WallConfig.Height;
|
||||||
this.radius = getConfig().getDouble("Abilities.Earth.Collapse.Radius");
|
this.radius = config.WallConfig.Radius;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.Collapse.Wall.Cooldown");
|
this.cooldown = config.WallConfig.Cooldown;
|
||||||
this.blocks = new ConcurrentHashMap<>();
|
this.blocks = new ConcurrentHashMap<>();
|
||||||
this.baseBlocks = new ConcurrentHashMap<>();
|
this.baseBlocks = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.height = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.Collapse.Wall.Height");
|
this.height = config.WallConfig.AvatarState_Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Block sblock = BlockSource.getEarthSourceBlock(player, this.selectRange, ClickType.SHIFT_DOWN);
|
final Block sblock = BlockSource.getEarthSourceBlock(player, this.selectRange, ClickType.SHIFT_DOWN);
|
||||||
|
@ -64,7 +65,7 @@ public class CollapseWall extends EarthAbility {
|
||||||
this.bPlayer.addCooldown("CollapseWall", this.cooldown);
|
this.bPlayer.addCooldown("CollapseWall", this.cooldown);
|
||||||
}
|
}
|
||||||
for (final Block block : this.baseBlocks.keySet()) {
|
for (final Block block : this.baseBlocks.keySet()) {
|
||||||
new Collapse(player, block.getLocation());
|
new Collapse(config, player, block.getLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.projectkorra.projectkorra.earthbending;
|
package com.projectkorra.projectkorra.earthbending;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
|
@ -23,11 +23,14 @@ import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.EarthArmorConfig;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.properties.GeneralPropertiesConfig;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||||
import com.projectkorra.projectkorra.util.TempArmor;
|
import com.projectkorra.projectkorra.util.TempArmor;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public class EarthArmor extends EarthAbility {
|
public class EarthArmor extends EarthAbility<EarthArmorConfig> {
|
||||||
|
|
||||||
private boolean formed;
|
private boolean formed;
|
||||||
private Material headMaterial;
|
private Material headMaterial;
|
||||||
|
@ -50,8 +53,8 @@ public class EarthArmor extends EarthAbility {
|
||||||
private int maxGoldHearts;
|
private int maxGoldHearts;
|
||||||
private TempArmor armor;
|
private TempArmor armor;
|
||||||
|
|
||||||
public EarthArmor(final Player player) {
|
public EarthArmor(final EarthArmorConfig config, final Player player) {
|
||||||
super(player);
|
super(config, player);
|
||||||
if (hasAbility(player, EarthArmor.class) || !this.canBend()) {
|
if (hasAbility(player, EarthArmor.class) || !this.canBend()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -60,14 +63,14 @@ public class EarthArmor extends EarthAbility {
|
||||||
this.active = true;
|
this.active = true;
|
||||||
this.interval = 2000;
|
this.interval = 2000;
|
||||||
this.goldHearts = 0;
|
this.goldHearts = 0;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.EarthArmor.Cooldown");
|
this.cooldown = config.Cooldown;
|
||||||
this.maxDuration = getConfig().getLong("Abilities.Earth.EarthArmor.MaxDuration");
|
this.maxDuration = config.MaxDuration;
|
||||||
this.selectRange = getConfig().getDouble("Abilities.Earth.EarthArmor.SelectRange");
|
this.selectRange = config.SelectRange;
|
||||||
this.maxGoldHearts = getConfig().getInt("Abilities.Earth.EarthArmor.GoldHearts");
|
this.maxGoldHearts = config.GoldHearts;
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthArmor.Cooldown");
|
this.cooldown = config.AvatarState_Cooldown;
|
||||||
this.maxGoldHearts = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.EarthArmor.GoldHearts");
|
this.maxGoldHearts = config.AvatarState_GoldHearts;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.headBlock = this.getTargetEarthBlock((int) this.selectRange);
|
this.headBlock = this.getTargetEarthBlock((int) this.selectRange);
|
||||||
|
@ -469,7 +472,6 @@ public class EarthArmor extends EarthAbility {
|
||||||
|
|
||||||
private boolean canBend() {
|
private boolean canBend() {
|
||||||
|
|
||||||
final List<String> disabledWorlds = getConfig().getStringList("Properties.DisabledWorlds");
|
|
||||||
final Location playerLoc = this.player.getLocation();
|
final Location playerLoc = this.player.getLocation();
|
||||||
|
|
||||||
if (!this.player.isOnline() || this.player.isDead()) {
|
if (!this.player.isOnline() || this.player.isDead()) {
|
||||||
|
@ -481,7 +483,7 @@ public class EarthArmor extends EarthAbility {
|
||||||
return false;
|
return false;
|
||||||
} else if (this.getPlayer() != null && this.getLocation() != null && !this.getLocation().getWorld().equals(this.player.getWorld())) {
|
} else if (this.getPlayer() != null && this.getLocation() != null && !this.getLocation().getWorld().equals(this.player.getWorld())) {
|
||||||
return false;
|
return false;
|
||||||
} else if (disabledWorlds != null && disabledWorlds.contains(this.player.getWorld().getName())) {
|
} else if (Stream.of(ConfigManager.getConfig(GeneralPropertiesConfig.class).DisabledWorlds).anyMatch(this.player.getWorld().getName()::equalsIgnoreCase)) {
|
||||||
return false;
|
return false;
|
||||||
} else if (Commands.isToggledForAll || !this.bPlayer.isToggled() || !this.bPlayer.isElementToggled(this.getElement())) {
|
} else if (Commands.isToggledForAll || !this.bPlayer.isToggled() || !this.bPlayer.isElementToggled(this.getElement())) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -16,13 +16,14 @@ import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.Collision;
|
import com.projectkorra.projectkorra.ability.util.Collision;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.EarthBlastConfig;
|
||||||
import com.projectkorra.projectkorra.earthbending.passive.DensityShift;
|
import com.projectkorra.projectkorra.earthbending.passive.DensityShift;
|
||||||
import com.projectkorra.projectkorra.util.BlockSource;
|
import com.projectkorra.projectkorra.util.BlockSource;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public class EarthBlast extends EarthAbility {
|
public class EarthBlast extends EarthAbility<EarthBlastConfig> {
|
||||||
private boolean isProgressing;
|
private boolean isProgressing;
|
||||||
private boolean isAtDestination;
|
private boolean isAtDestination;
|
||||||
private boolean isSettingUp;
|
private boolean isSettingUp;
|
||||||
|
@ -50,28 +51,27 @@ public class EarthBlast extends EarthAbility {
|
||||||
private Location firstDestination;
|
private Location firstDestination;
|
||||||
private Block sourceBlock;
|
private Block sourceBlock;
|
||||||
|
|
||||||
public EarthBlast(final Player player) {
|
public EarthBlast(final EarthBlastConfig config, final Player player) {
|
||||||
super(player);
|
super(config, player);
|
||||||
|
|
||||||
this.isProgressing = false;
|
this.isProgressing = false;
|
||||||
this.isAtDestination = false;
|
this.isAtDestination = false;
|
||||||
this.isSettingUp = true;
|
this.isSettingUp = true;
|
||||||
this.deflectRange = getConfig().getDouble("Abilities.Earth.EarthBlast.DeflectRange");
|
this.deflectRange = config.DeflectRange;
|
||||||
this.collisionRadius = getConfig().getDouble("Abilities.Earth.EarthBlast.CollisionRadius");
|
this.collisionRadius = config.CollisionRadius;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.EarthBlast.Cooldown");
|
this.cooldown = config.Cooldown;
|
||||||
this.canHitSelf = getConfig().getBoolean("Abilities.Earth.EarthBlast.CanHitSelf");
|
this.canHitSelf = config.CanHitSelf;
|
||||||
this.range = getConfig().getDouble("Abilities.Earth.EarthBlast.Range");
|
this.range = config.Range;
|
||||||
this.damage = getConfig().getDouble("Abilities.Earth.EarthBlast.Damage");
|
this.damage = config.Damage;
|
||||||
this.speed = getConfig().getDouble("Abilities.Earth.EarthBlast.Speed");
|
this.speed = config.Speed;
|
||||||
this.pushFactor = getConfig().getDouble("Abilities.Earth.EarthBlast.Push");
|
this.pushFactor = config.PushFactor;
|
||||||
this.selectRange = getConfig().getDouble("Abilities.Earth.EarthBlast.SelectRange");
|
this.selectRange = config.SelectRange;
|
||||||
this.time = System.currentTimeMillis();
|
this.time = System.currentTimeMillis();
|
||||||
this.interval = (long) (1000.0 / this.speed);
|
this.interval = (long) (1000.0 / this.speed);
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthBlast.Cooldown");
|
this.cooldown = config.AvatarState_Cooldown;
|
||||||
this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthBlast.Damage");
|
this.damage = config.AvatarState_Damage;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.prepare()) {
|
if (this.prepare()) {
|
||||||
|
@ -135,11 +135,7 @@ public class EarthBlast extends EarthAbility {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
for (int j = 0; j < this.getEarthbendableBlocks().size(); j++) {
|
for (int j = 0; j < this.getEarthbendableBlocks().size(); j++) {
|
||||||
try {
|
trans[i] = this.getEarthbendableBlocks().get(j);
|
||||||
trans[i] = Material.valueOf(this.getEarthbendableBlocks().get(j));
|
|
||||||
} catch (final IllegalArgumentException e) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,11 @@ import org.bukkit.entity.Player;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.EarthDomeConfig;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.RaiseEarthConfig;
|
||||||
|
|
||||||
public class EarthDome extends EarthAbility {
|
public class EarthDome extends EarthAbility<EarthDomeConfig> {
|
||||||
|
|
||||||
private Location center;
|
private Location center;
|
||||||
@Attribute(Attribute.RADIUS)
|
@Attribute(Attribute.RADIUS)
|
||||||
|
@ -25,24 +28,24 @@ public class EarthDome extends EarthAbility {
|
||||||
private long cooldown;
|
private long cooldown;
|
||||||
private Set<Block> checked;
|
private Set<Block> checked;
|
||||||
|
|
||||||
public EarthDome(final Player player, final Location center) {
|
public EarthDome(final EarthDomeConfig config, final Player player, final Location center) {
|
||||||
super(player);
|
super(config, player);
|
||||||
|
|
||||||
if (this.bPlayer.isOnCooldown("EarthDome")) {
|
if (this.bPlayer.isOnCooldown("EarthDome")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.center = center;
|
this.center = center;
|
||||||
this.radius = getConfig().getDouble("Abilities.Earth.EarthDome.Radius");
|
this.radius = config.Radius;
|
||||||
this.height = getConfig().getInt("Abilities.Earth.EarthDome.Height");
|
this.height = config.Height;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.EarthDome.Cooldown");
|
this.cooldown = config.Cooldown;
|
||||||
this.checked = new HashSet<>();
|
this.checked = new HashSet<>();
|
||||||
|
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EarthDome(final Player player) {
|
public EarthDome(final EarthDomeConfig config, final Player player) {
|
||||||
this(player, player.getLocation().clone().subtract(0, 1, 0));
|
this(config, player, player.getLocation().clone().subtract(0, 1, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Block getAppropriateBlock(final Block block) {
|
private Block getAppropriateBlock(final Block block) {
|
||||||
|
@ -81,7 +84,7 @@ public class EarthDome extends EarthAbility {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
new RaiseEarth(this.player, currBlock.getLocation(), Math.round(this.height - i));
|
new RaiseEarth(ConfigManager.getConfig(RaiseEarthConfig.class), this.player, currBlock.getLocation(), Math.round(this.height - i));
|
||||||
this.checked.add(currBlock);
|
this.checked.add(currBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,14 @@ import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.EarthGrabConfig;
|
||||||
import com.projectkorra.projectkorra.util.MovementHandler;
|
import com.projectkorra.projectkorra.util.MovementHandler;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||||
import com.projectkorra.projectkorra.util.TempArmor;
|
import com.projectkorra.projectkorra.util.TempArmor;
|
||||||
import com.projectkorra.projectkorra.util.TempArmorStand;
|
import com.projectkorra.projectkorra.util.TempArmorStand;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public class EarthGrab extends EarthAbility {
|
public class EarthGrab extends EarthAbility<EarthGrabConfig> {
|
||||||
|
|
||||||
private LivingEntity target;
|
private LivingEntity target;
|
||||||
@Attribute(Attribute.COOLDOWN)
|
@Attribute(Attribute.COOLDOWN)
|
||||||
|
@ -66,8 +67,8 @@ public class EarthGrab extends EarthAbility {
|
||||||
TRAP, DRAG, PROJECTING;
|
TRAP, DRAG, PROJECTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EarthGrab(final Player player, final GrabMode mode) {
|
public EarthGrab(final EarthGrabConfig config, final Player player, final GrabMode mode) {
|
||||||
super(player);
|
super(config, player);
|
||||||
|
|
||||||
if (hasAbility(player, EarthGrab.class)) {
|
if (hasAbility(player, EarthGrab.class)) {
|
||||||
getAbility(player, EarthGrab.class).remove();
|
getAbility(player, EarthGrab.class).remove();
|
||||||
|
@ -88,12 +89,12 @@ public class EarthGrab extends EarthAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setFields() {
|
private void setFields() {
|
||||||
this.range = getConfig().getDouble("Abilities.Earth.EarthGrab.Range");
|
this.range = config.Range;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.EarthGrab.Cooldown");
|
this.cooldown = config.Cooldown;
|
||||||
this.dragSpeed = getConfig().getDouble("Abilities.Earth.EarthGrab.DragSpeed");
|
this.dragSpeed = config.DragSpeed;
|
||||||
this.interval = getConfig().getLong("Abilities.Earth.EarthGrab.TrapHitInterval");
|
this.interval = config.TrapHitInterval;
|
||||||
this.trapHP = getConfig().getDouble("Abilities.Earth.EarthGrab.TrapHP");
|
this.trapHP = config.TrapHP;
|
||||||
this.damageThreshold = getConfig().getDouble("Abilities.Earth.EarthGrab.DamageThreshold");
|
this.damageThreshold = config.DamageThreshold;
|
||||||
this.origin = this.player.getLocation().clone();
|
this.origin = this.player.getLocation().clone();
|
||||||
this.direction = this.player.getLocation().getDirection().setY(0).normalize();
|
this.direction = this.player.getLocation().getDirection().setY(0).normalize();
|
||||||
this.lastHit = 0;
|
this.lastHit = 0;
|
||||||
|
|
|
@ -20,12 +20,13 @@ import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.EarthSmashConfig;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public class EarthSmash extends EarthAbility {
|
public class EarthSmash extends EarthAbility<EarthSmashConfig> {
|
||||||
|
|
||||||
public static enum State {
|
public static enum State {
|
||||||
START, LIFTING, LIFTED, GRABBED, SHOT, FLYING, REMOVED
|
START, LIFTING, LIFTED, GRABBED, SHOT, FLYING, REMOVED
|
||||||
|
@ -77,12 +78,12 @@ public class EarthSmash extends EarthAbility {
|
||||||
private ArrayList<BlockRepresenter> currentBlocks;
|
private ArrayList<BlockRepresenter> currentBlocks;
|
||||||
private ArrayList<TempBlock> affectedBlocks;
|
private ArrayList<TempBlock> affectedBlocks;
|
||||||
|
|
||||||
public EarthSmash(final Player player, final ClickType type) {
|
public EarthSmash(final EarthSmashConfig config, final Player player, final ClickType type) {
|
||||||
super(player);
|
super(config, player);
|
||||||
|
|
||||||
this.state = State.START;
|
this.state = State.START;
|
||||||
this.requiredBendableBlocks = getConfig().getInt("Abilities.Earth.EarthSmash.RequiredBendableBlocks");
|
this.requiredBendableBlocks = config.RequiredBendableBlocks;
|
||||||
this.maxBlocksToPassThrough = getConfig().getInt("Abilities.Earth.EarthSmash.MaxBlocksToPassThrough");
|
this.maxBlocksToPassThrough = config.MaxBlocksToPassThrough;
|
||||||
this.setFields();
|
this.setFields();
|
||||||
this.affectedEntities = new ArrayList<>();
|
this.affectedEntities = new ArrayList<>();
|
||||||
this.currentBlocks = new ArrayList<>();
|
this.currentBlocks = new ArrayList<>();
|
||||||
|
@ -142,35 +143,35 @@ public class EarthSmash extends EarthAbility {
|
||||||
|
|
||||||
public void setFields() {
|
public void setFields() {
|
||||||
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(this.player);
|
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(this.player);
|
||||||
this.shootAnimationInterval = getConfig().getLong("Abilities.Earth.EarthSmash.Shoot.AnimationInterval");
|
this.shootAnimationInterval = config.ShootAnimationInterval;
|
||||||
this.flightAnimationInterval = getConfig().getLong("Abilities.Earth.EarthSmash.Flight.AnimationInterval");
|
this.flightAnimationInterval = config.FlightConfig.AnimationInterval;
|
||||||
this.liftAnimationInterval = getConfig().getLong("Abilities.Earth.EarthSmash.LiftAnimationInterval");
|
this.liftAnimationInterval = config.LiftAnimationInterval;
|
||||||
this.grabDetectionRadius = getConfig().getDouble("Abilities.Earth.EarthSmash.Grab.DetectionRadius");
|
this.grabDetectionRadius = config.GrabConfig.DetectionRadius;
|
||||||
this.flightDetectionRadius = getConfig().getDouble("Abilities.Earth.EarthSmash.Flight.DetectionRadius");
|
this.flightDetectionRadius = config.FlightConfig.DetectionRadius;
|
||||||
this.allowGrab = getConfig().getBoolean("Abilities.Earth.EarthSmash.Grab.Enabled");
|
this.allowGrab = config.GrabConfig.Enabled;
|
||||||
this.allowFlight = getConfig().getBoolean("Abilities.Earth.EarthSmash.Flight.Enabled");
|
this.allowFlight = config.FlightConfig.Enabled;
|
||||||
this.selectRange = getConfig().getDouble("Abilities.Earth.EarthSmash.SelectRange");
|
this.selectRange = config.SelectRange;
|
||||||
this.grabRange = getConfig().getDouble("Abilities.Earth.EarthSmash.Grab.Range");
|
this.grabRange = config.GrabConfig.Range;
|
||||||
this.shootRange = getConfig().getDouble("Abilities.Earth.EarthSmash.Shoot.Range");
|
this.shootRange = config.ShootRange;
|
||||||
this.damage = getConfig().getDouble("Abilities.Earth.EarthSmash.Damage");
|
this.damage = config.Damage;
|
||||||
this.knockback = getConfig().getDouble("Abilities.Earth.EarthSmash.Knockback");
|
this.knockback = config.Knockback;
|
||||||
this.knockup = getConfig().getDouble("Abilities.Earth.EarthSmash.Knockup");
|
this.knockup = config.Knockup;
|
||||||
this.flightSpeed = getConfig().getDouble("Abilities.Earth.EarthSmash.Flight.Speed");
|
this.flightSpeed = config.FlightConfig.Speed;
|
||||||
this.chargeTime = getConfig().getLong("Abilities.Earth.EarthSmash.ChargeTime");
|
this.chargeTime = config.ChargeTime;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.EarthSmash.Cooldown");
|
this.cooldown = config.Cooldown;
|
||||||
this.flightDuration = getConfig().getLong("Abilities.Earth.EarthSmash.Flight.Duration");
|
this.flightDuration = config.FlightConfig.Duration;
|
||||||
this.duration = getConfig().getLong("Abilities.Earth.EarthSmash.Duration");
|
this.duration = config.Duration;
|
||||||
|
|
||||||
if (bPlayer.isAvatarState()) {
|
if (bPlayer.isAvatarState()) {
|
||||||
this.selectRange = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.SelectRange");
|
this.selectRange = config.AvatarState_SelectRange;
|
||||||
this.grabRange = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.Grab.Range");
|
this.grabRange = config.GrabConfig.AvatarState_Range;
|
||||||
this.chargeTime = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthSmash.ChargeTime");
|
this.chargeTime = config.AvatarState_ChargeTime;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthSmash.Cooldown");
|
this.cooldown = config.AvatarState_Cooldown;
|
||||||
this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.Damage");
|
this.damage = config.AvatarState_Damage;
|
||||||
this.knockback = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.Knockback");
|
this.knockback = config.AvatarState_Knockback;
|
||||||
this.flightSpeed = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.Flight.Speed");
|
this.flightSpeed = config.FlightConfig.AvatarState_Speed;
|
||||||
this.flightDuration = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthSmash.Flight.Duration");
|
this.flightDuration = config.FlightConfig.AvatarState_Duration;
|
||||||
this.shootRange = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.Shoot.Range");
|
this.shootRange = config.AvatarState_ShootRange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,10 @@ import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.EarthTunnelConfig;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public class EarthTunnel extends EarthAbility {
|
public class EarthTunnel extends EarthAbility<EarthTunnelConfig> {
|
||||||
|
|
||||||
private long interval;
|
private long interval;
|
||||||
private int blocksPerInterval;
|
private int blocksPerInterval;
|
||||||
|
@ -40,19 +41,19 @@ public class EarthTunnel extends EarthAbility {
|
||||||
private Location location;
|
private Location location;
|
||||||
private Vector direction;
|
private Vector direction;
|
||||||
|
|
||||||
public EarthTunnel(final Player player) {
|
public EarthTunnel(final EarthTunnelConfig config, final Player player) {
|
||||||
super(player);
|
super(config, player);
|
||||||
|
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.EarthTunnel.Cooldown");
|
this.cooldown = config.Cooldown;
|
||||||
this.maxRadius = getConfig().getDouble("Abilities.Earth.EarthTunnel.MaxRadius");
|
this.maxRadius = config.MaxRadius;
|
||||||
this.range = getConfig().getDouble("Abilities.Earth.EarthTunnel.Range");
|
this.range = config.Range;
|
||||||
this.radius = getConfig().getDouble("Abilities.Earth.EarthTunnel.Radius");
|
this.radius = config.InitialRadius;
|
||||||
this.interval = getConfig().getLong("Abilities.Earth.EarthTunnel.Interval");
|
this.interval = config.Interval;
|
||||||
this.blocksPerInterval = getConfig().getInt("Abilities.Earth.EarthTunnel.BlocksPerInterval");
|
this.blocksPerInterval = config.BlocksPerInterval;
|
||||||
this.revert = getConfig().getBoolean("Abilities.Earth.EarthTunnel.Revert");
|
this.revert = config.Revert;
|
||||||
this.dropLootIfNotRevert = getConfig().getBoolean("Abilities.Earth.EarthTunnel.DropLootIfNotRevert");
|
this.dropLootIfNotRevert = config.DropLootIfNotRevert;
|
||||||
this.ignoreOres = getConfig().getBoolean("Abilities.Earth.EarthTunnel.IgnoreOres");
|
this.ignoreOres = config.IgnoreOres;
|
||||||
this.revertTime = getConfig().getLong("Properties.Earth.RevertCheckTime");
|
this.revertTime = config.RevertCheckTime;
|
||||||
|
|
||||||
this.time = System.currentTimeMillis();
|
this.time = System.currentTimeMillis();
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@ public class EarthTunnel extends EarthAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.maxRadius = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthTunnel.Radius");
|
this.maxRadius = config.AvatarState_MaxRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.radiusIncrement = this.radius;
|
this.radiusIncrement = this.radius;
|
||||||
|
|
|
@ -12,11 +12,11 @@ import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.RaiseEarthConfig;
|
||||||
import com.projectkorra.projectkorra.util.BlockSource;
|
import com.projectkorra.projectkorra.util.BlockSource;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
|
|
||||||
public class RaiseEarth extends EarthAbility {
|
public class RaiseEarth extends EarthAbility<RaiseEarthConfig> {
|
||||||
|
|
||||||
private static final Map<Block, Block> ALL_AFFECTED_BLOCKS = new ConcurrentHashMap<>();
|
private static final Map<Block, Block> ALL_AFFECTED_BLOCKS = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ public class RaiseEarth extends EarthAbility {
|
||||||
private Location location;
|
private Location location;
|
||||||
private ConcurrentHashMap<Block, Block> affectedBlocks;
|
private ConcurrentHashMap<Block, Block> affectedBlocks;
|
||||||
|
|
||||||
public RaiseEarth(final Player player) {
|
public RaiseEarth(final RaiseEarthConfig config, final Player player) {
|
||||||
super(player);
|
super(config, player);
|
||||||
this.setFields();
|
this.setFields();
|
||||||
|
|
||||||
if (!this.bPlayer.canBend(this) || this.bPlayer.isOnCooldown("RaiseEarthPillar")) {
|
if (!this.bPlayer.canBend(this) || this.bPlayer.isOnCooldown("RaiseEarthPillar")) {
|
||||||
|
@ -47,7 +47,7 @@ public class RaiseEarth extends EarthAbility {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.height = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.RaiseEarth.Column.Height");
|
this.height = config.ColumnConfig.AvatarState_Height;
|
||||||
}
|
}
|
||||||
this.block = BlockSource.getEarthSourceBlock(player, this.selectRange, ClickType.LEFT_CLICK);
|
this.block = BlockSource.getEarthSourceBlock(player, this.selectRange, ClickType.LEFT_CLICK);
|
||||||
if (this.block == null) {
|
if (this.block == null) {
|
||||||
|
@ -70,12 +70,12 @@ public class RaiseEarth extends EarthAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public RaiseEarth(final Player player, final Location origin) {
|
public RaiseEarth(final RaiseEarthConfig config, final Player player, final Location origin) {
|
||||||
this(player, origin, ConfigManager.getConfig().getInt("Abilities.Earth.RaiseEarth.Column.Height"));
|
this(config, player, origin, config.ColumnConfig.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RaiseEarth(final Player player, final Location origin, final int height) {
|
public RaiseEarth(final RaiseEarthConfig config, final Player player, final Location origin, final int height) {
|
||||||
super(player);
|
super(config, player);
|
||||||
this.setFields();
|
this.setFields();
|
||||||
|
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
@ -93,10 +93,10 @@ public class RaiseEarth extends EarthAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setFields() {
|
private void setFields() {
|
||||||
this.speed = getConfig().getDouble("Abilities.Earth.RaiseEarth.Speed");
|
this.speed = config.ColumnConfig.Speed;
|
||||||
this.height = getConfig().getInt("Abilities.Earth.RaiseEarth.Column.Height");
|
this.height = config.ColumnConfig.Height;
|
||||||
this.selectRange = getConfig().getDouble("Abilities.Earth.RaiseEarth.Column.SelectRange");
|
this.selectRange = config.ColumnConfig.SelectRange;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.RaiseEarth.Column.Cooldown");
|
this.cooldown = config.ColumnConfig.Cooldown;
|
||||||
this.direction = new Vector(0, 1, 0);
|
this.direction = new Vector(0, 1, 0);
|
||||||
this.interval = (long) (1000.0 / this.speed);
|
this.interval = (long) (1000.0 / this.speed);
|
||||||
this.affectedBlocks = new ConcurrentHashMap<>();
|
this.affectedBlocks = new ConcurrentHashMap<>();
|
||||||
|
|
|
@ -9,10 +9,11 @@ import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.RaiseEarthConfig;
|
||||||
import com.projectkorra.projectkorra.util.BlockSource;
|
import com.projectkorra.projectkorra.util.BlockSource;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
|
|
||||||
public class RaiseEarthWall extends EarthAbility {
|
public class RaiseEarthWall extends EarthAbility<RaiseEarthConfig> {
|
||||||
|
|
||||||
@Attribute(Attribute.SELECT_RANGE)
|
@Attribute(Attribute.SELECT_RANGE)
|
||||||
private int selectRange;
|
private int selectRange;
|
||||||
|
@ -24,20 +25,20 @@ public class RaiseEarthWall extends EarthAbility {
|
||||||
private long cooldown;
|
private long cooldown;
|
||||||
private Location location;
|
private Location location;
|
||||||
|
|
||||||
public RaiseEarthWall(final Player player) {
|
public RaiseEarthWall(final RaiseEarthConfig config, final Player player) {
|
||||||
super(player);
|
super(config, player);
|
||||||
this.selectRange = getConfig().getInt("Abilities.Earth.RaiseEarth.Wall.SelectRange");
|
this.selectRange = config.WallConfig.SelectRange;
|
||||||
this.height = getConfig().getInt("Abilities.Earth.RaiseEarth.Wall.Height");
|
this.height = config.WallConfig.Height;
|
||||||
this.width = getConfig().getInt("Abilities.Earth.RaiseEarth.Wall.Width");
|
this.width = config.WallConfig.Width;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.RaiseEarth.Wall.Cooldown");
|
this.cooldown = config.WallConfig.Cooldown;
|
||||||
|
|
||||||
if (!this.bPlayer.canBend(this) || this.bPlayer.isOnCooldown("RaiseEarthWall")) {
|
if (!this.bPlayer.canBend(this) || this.bPlayer.isOnCooldown("RaiseEarthWall")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.height = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.RaiseEarth.Wall.Height");
|
this.height = config.WallConfig.AvatarState_Height;
|
||||||
this.width = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.RaiseEarth.Wall.Width");
|
this.width = config.WallConfig.AvatarState_Width;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.start();
|
this.start();
|
||||||
|
@ -105,7 +106,7 @@ public class RaiseEarthWall extends EarthAbility {
|
||||||
block = block.getRelative(BlockFace.DOWN);
|
block = block.getRelative(BlockFace.DOWN);
|
||||||
if (this.isEarthbendable(block)) {
|
if (this.isEarthbendable(block)) {
|
||||||
shouldAddCooldown = true;
|
shouldAddCooldown = true;
|
||||||
new RaiseEarth(this.player, block.getLocation(), this.height);
|
new RaiseEarth(config, this.player, block.getLocation(), this.height);
|
||||||
} else if (!this.isTransparent(block)) {
|
} else if (!this.isTransparent(block)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -115,14 +116,14 @@ public class RaiseEarthWall extends EarthAbility {
|
||||||
block = block.getRelative(BlockFace.UP);
|
block = block.getRelative(BlockFace.UP);
|
||||||
if (this.isTransparent(block)) {
|
if (this.isTransparent(block)) {
|
||||||
shouldAddCooldown = true;
|
shouldAddCooldown = true;
|
||||||
new RaiseEarth(this.player, block.getRelative(BlockFace.DOWN).getLocation(), this.height);
|
new RaiseEarth(config, this.player, block.getRelative(BlockFace.DOWN).getLocation(), this.height);
|
||||||
} else if (!this.isEarthbendable(block)) {
|
} else if (!this.isEarthbendable(block)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this.isEarthbendable(block)) {
|
} else if (this.isEarthbendable(block)) {
|
||||||
shouldAddCooldown = true;
|
shouldAddCooldown = true;
|
||||||
new RaiseEarth(this.player, block.getLocation(), this.height);
|
new RaiseEarth(config, this.player, block.getLocation(), this.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,10 @@ import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.ShockwaveConfig;
|
||||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||||
|
|
||||||
public class Ripple extends EarthAbility {
|
public class Ripple extends EarthAbility<ShockwaveConfig> {
|
||||||
|
|
||||||
private static final Map<Integer[], Block> BLOCKS = new ConcurrentHashMap<Integer[], Block>();
|
private static final Map<Integer[], Block> BLOCKS = new ConcurrentHashMap<Integer[], Block>();
|
||||||
|
|
||||||
|
@ -43,13 +44,13 @@ public class Ripple extends EarthAbility {
|
||||||
private ArrayList<Location> locations = new ArrayList<Location>();
|
private ArrayList<Location> locations = new ArrayList<Location>();
|
||||||
private ArrayList<Entity> entities = new ArrayList<Entity>();
|
private ArrayList<Entity> entities = new ArrayList<Entity>();
|
||||||
|
|
||||||
public Ripple(final Player player, final Vector direction) {
|
public Ripple(final ShockwaveConfig config, final Player player, final Vector direction) {
|
||||||
super(player);
|
super(config, player);
|
||||||
this.initialize(player, this.getInitialLocation(player, direction), direction);
|
this.initialize(player, this.getInitialLocation(player, direction), direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ripple(final Player player, final Location origin, final Vector direction) {
|
public Ripple(final ShockwaveConfig config, final Player player, final Location origin, final Vector direction) {
|
||||||
super(player);
|
super(config, player);
|
||||||
this.initialize(player, origin, direction);
|
this.initialize(player, origin, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,9 +59,9 @@ public class Ripple extends EarthAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.range = getConfig().getDouble("Abilities.Earth.Shockwave.Range");
|
this.range = config.Range;
|
||||||
this.damage = getConfig().getDouble("Abilities.Earth.Shockwave.Damage");
|
this.damage = config.Damage;
|
||||||
this.knockback = getConfig().getDouble("Abilities.Earth.Shockwave.Knockback");
|
this.knockback = config.Knockback;
|
||||||
this.direction = direction.clone().normalize();
|
this.direction = direction.clone().normalize();
|
||||||
this.origin = origin.clone();
|
this.origin = origin.clone();
|
||||||
this.location = origin.clone();
|
this.location = origin.clone();
|
||||||
|
@ -68,9 +69,9 @@ public class Ripple extends EarthAbility {
|
||||||
this.entities = new ArrayList<>();
|
this.entities = new ArrayList<>();
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.range = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.Shockwave.Range");
|
this.range = config.AvatarState_Range;
|
||||||
this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.Shockwave.Damage");
|
this.damage = config.AvatarState_Damage;
|
||||||
this.knockback = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.Shockwave.Knockback");
|
this.knockback = config.AvatarState_Knockback;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.initializeLocations();
|
this.initializeLocations();
|
||||||
|
|
|
@ -6,9 +6,10 @@ import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.ShockwaveConfig;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||||
|
|
||||||
public class Shockwave extends EarthAbility {
|
public class Shockwave extends EarthAbility<ShockwaveConfig> {
|
||||||
|
|
||||||
private boolean charged;
|
private boolean charged;
|
||||||
@Attribute(Attribute.CHARGE_DURATION)
|
@Attribute(Attribute.CHARGE_DURATION)
|
||||||
|
@ -20,19 +21,19 @@ public class Shockwave extends EarthAbility {
|
||||||
@Attribute(Attribute.RANGE)
|
@Attribute(Attribute.RANGE)
|
||||||
private double range;
|
private double range;
|
||||||
|
|
||||||
public Shockwave(final Player player, final boolean fall) {
|
public Shockwave(final ShockwaveConfig config, final Player player, final boolean fall) {
|
||||||
super(player);
|
super(config, player);
|
||||||
|
|
||||||
this.angle = Math.toRadians(getConfig().getDouble("Abilities.Earth.Shockwave.Angle"));
|
this.angle = Math.toRadians(config.Angle);
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.Shockwave.Cooldown");
|
this.cooldown = config.Cooldown;
|
||||||
this.chargeTime = getConfig().getLong("Abilities.Earth.Shockwave.ChargeTime");
|
this.chargeTime = config.ChargeTime;
|
||||||
this.threshold = getConfig().getDouble("Abilities.Earth.Shockwave.FallThreshold");
|
this.threshold = config.FallThreshold;
|
||||||
this.range = getConfig().getDouble("Abilities.Earth.Shockwave.Range");
|
this.range = config.Range;
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.range = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.Shockwave.Range");
|
this.range = config.AvatarState_Range;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.Shockwave.Cooldown");
|
this.cooldown = config.AvatarState_Cooldown;
|
||||||
this.chargeTime = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.Shockwave.ChargeTime");
|
this.chargeTime = config.AvatarState_ChargeTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.bPlayer.canBend(this) || hasAbility(player, Shockwave.class)) {
|
if (!this.bPlayer.canBend(this) || hasAbility(player, Shockwave.class)) {
|
||||||
|
@ -96,12 +97,12 @@ public class Shockwave extends EarthAbility {
|
||||||
for (double theta = 0; theta < 360; theta += dtheta) {
|
for (double theta = 0; theta < 360; theta += dtheta) {
|
||||||
final double rtheta = Math.toRadians(theta);
|
final double rtheta = Math.toRadians(theta);
|
||||||
final Vector vector = new Vector(Math.cos(rtheta), 0, Math.sin(rtheta));
|
final Vector vector = new Vector(Math.cos(rtheta), 0, Math.sin(rtheta));
|
||||||
new Ripple(this.player, vector.normalize());
|
new Ripple(config, this.player, vector.normalize());
|
||||||
}
|
}
|
||||||
this.bPlayer.addCooldown(this);
|
this.bPlayer.addCooldown(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void coneShockwave(final Player player) {
|
public static void coneShockwave(final ShockwaveConfig config, final Player player) {
|
||||||
final Shockwave shockWave = getAbility(player, Shockwave.class);
|
final Shockwave shockWave = getAbility(player, Shockwave.class);
|
||||||
if (shockWave != null) {
|
if (shockWave != null) {
|
||||||
if (shockWave.charged) {
|
if (shockWave.charged) {
|
||||||
|
@ -111,7 +112,7 @@ public class Shockwave extends EarthAbility {
|
||||||
final double rtheta = Math.toRadians(theta);
|
final double rtheta = Math.toRadians(theta);
|
||||||
final Vector vector = new Vector(Math.cos(rtheta), 0, Math.sin(rtheta));
|
final Vector vector = new Vector(Math.cos(rtheta), 0, Math.sin(rtheta));
|
||||||
if (vector.angle(player.getEyeLocation().getDirection()) < shockWave.angle) {
|
if (vector.angle(player.getEyeLocation().getDirection()) < shockWave.angle) {
|
||||||
new Ripple(player, vector.normalize());
|
new Ripple(config, player, vector.normalize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shockWave.bPlayer.addCooldown(shockWave);
|
shockWave.bPlayer.addCooldown(shockWave);
|
||||||
|
|
|
@ -16,8 +16,10 @@ import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.TremorsenseConfig;
|
||||||
|
|
||||||
public class Tremorsense extends EarthAbility {
|
@SuppressWarnings("deprecation")
|
||||||
|
public class Tremorsense extends EarthAbility<TremorsenseConfig> {
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private static final Map<Block, Player> BLOCKS = new ConcurrentHashMap<Block, Player>();
|
private static final Map<Block, Player> BLOCKS = new ConcurrentHashMap<Block, Player>();
|
||||||
|
@ -33,8 +35,8 @@ public class Tremorsense extends EarthAbility {
|
||||||
@Attribute(Attribute.RANGE)
|
@Attribute(Attribute.RANGE)
|
||||||
private int stickyRange;
|
private int stickyRange;
|
||||||
|
|
||||||
public Tremorsense(final Player player, final boolean clicked) {
|
public Tremorsense(final TremorsenseConfig config, final Player player, final boolean clicked) {
|
||||||
super(player);
|
super(config, player);
|
||||||
|
|
||||||
if (!this.bPlayer.canBendIgnoreBinds(this)) {
|
if (!this.bPlayer.canBendIgnoreBinds(this)) {
|
||||||
return;
|
return;
|
||||||
|
@ -53,11 +55,11 @@ public class Tremorsense extends EarthAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setFields() {
|
private void setFields() {
|
||||||
this.maxDepth = getConfig().getInt("Abilities.Earth.Tremorsense.MaxDepth");
|
this.maxDepth = config.MaxDepth;
|
||||||
this.radius = getConfig().getInt("Abilities.Earth.Tremorsense.Radius");
|
this.radius = config.Radius;
|
||||||
this.lightThreshold = (byte) getConfig().getInt("Abilities.Earth.Tremorsense.LightThreshold");
|
this.lightThreshold = config.LightThreshold;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.Tremorsense.Cooldown");
|
this.cooldown = config.Cooldown;
|
||||||
this.stickyRange = getConfig().getInt("Abilities.Earth.Tremorsense.StickyRange");
|
this.stickyRange = config.StickyRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void activate() {
|
private void activate() {
|
||||||
|
@ -148,11 +150,11 @@ public class Tremorsense extends EarthAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void manage(final Server server) {
|
public static void manage(final TremorsenseConfig config, final Server server) {
|
||||||
for (final Player player : server.getOnlinePlayers()) {
|
for (final Player player : server.getOnlinePlayers()) {
|
||||||
|
|
||||||
if (canTremorSense(player) && !hasAbility(player, Tremorsense.class)) {
|
if (canTremorSense(player) && !hasAbility(player, Tremorsense.class)) {
|
||||||
new Tremorsense(player, false);
|
new Tremorsense(config, player, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,11 @@ import org.bukkit.util.Vector;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.EarthDomeConfig;
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthDome;
|
import com.projectkorra.projectkorra.earthbending.EarthDome;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||||
|
|
||||||
public class EarthDomeOthers extends EarthAbility {
|
public class EarthDomeOthers extends EarthAbility<EarthDomeConfig> {
|
||||||
|
|
||||||
private Vector direction;
|
private Vector direction;
|
||||||
private double range;
|
private double range;
|
||||||
|
@ -22,8 +23,8 @@ public class EarthDomeOthers extends EarthAbility {
|
||||||
private double maxRange;
|
private double maxRange;
|
||||||
private Location loc;
|
private Location loc;
|
||||||
|
|
||||||
public EarthDomeOthers(final Player player) {
|
public EarthDomeOthers(final EarthDomeConfig config, final Player player) {
|
||||||
super(player);
|
super(config, player);
|
||||||
|
|
||||||
if (this.bPlayer.isOnCooldown("EarthDome")) {
|
if (this.bPlayer.isOnCooldown("EarthDome")) {
|
||||||
return;
|
return;
|
||||||
|
@ -38,7 +39,7 @@ public class EarthDomeOthers extends EarthAbility {
|
||||||
}
|
}
|
||||||
this.range = 0;
|
this.range = 0;
|
||||||
this.direction = this.loc.getDirection().setY(0);
|
this.direction = this.loc.getDirection().setY(0);
|
||||||
this.maxRange = getConfig().getDouble("Abilities.Earth.EarthDome.Range");
|
this.maxRange = config.Range;
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ public class EarthDomeOthers extends EarthAbility {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
new EarthDome(this.player, entity.getLocation().clone().subtract(0, 1, 0));
|
new EarthDome(config, this.player, entity.getLocation().clone().subtract(0, 1, 0));
|
||||||
this.remove(false);
|
this.remove(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +95,7 @@ public class EarthDomeOthers extends EarthAbility {
|
||||||
public void remove(final boolean cooldown) {
|
public void remove(final boolean cooldown) {
|
||||||
super.remove();
|
super.remove();
|
||||||
if (cooldown) {
|
if (cooldown) {
|
||||||
this.bPlayer.addCooldown("EarthDome", getConfig().getLong("Abilities.Earth.EarthDome.Cooldown"));
|
this.bPlayer.addCooldown("EarthDome", config.Cooldown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,15 +8,17 @@ import org.bukkit.entity.Player;
|
||||||
import com.projectkorra.projectkorra.ability.ComboAbility;
|
import com.projectkorra.projectkorra.ability.ComboAbility;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.EarthDomeConfig;
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthDome;
|
import com.projectkorra.projectkorra.earthbending.EarthDome;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
|
|
||||||
public class EarthDomeSelf extends EarthAbility implements ComboAbility {
|
public class EarthDomeSelf extends EarthAbility<EarthDomeConfig> implements ComboAbility {
|
||||||
|
|
||||||
public EarthDomeSelf(final Player player) {
|
public EarthDomeSelf(final EarthDomeConfig config, final Player player) {
|
||||||
super(player);
|
super(config, player);
|
||||||
|
|
||||||
new EarthDome(player);
|
new EarthDome(config, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,7 +51,7 @@ public class EarthDomeSelf extends EarthAbility implements ComboAbility {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object createNewComboInstance(final Player player) {
|
public Object createNewComboInstance(final Player player) {
|
||||||
return new EarthDomeSelf(player);
|
return new EarthDomeSelf(ConfigManager.getConfig(EarthDomeConfig.class), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,12 +17,15 @@ import com.projectkorra.projectkorra.ability.ComboAbility;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.EarthPillarsConfig;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.RaiseEarthConfig;
|
||||||
import com.projectkorra.projectkorra.earthbending.RaiseEarth;
|
import com.projectkorra.projectkorra.earthbending.RaiseEarth;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||||
|
|
||||||
public class EarthPillars extends EarthAbility implements ComboAbility {
|
public class EarthPillars extends EarthAbility<EarthPillarsConfig> implements ComboAbility {
|
||||||
|
|
||||||
@Attribute(Attribute.RADIUS)
|
@Attribute(Attribute.RADIUS)
|
||||||
private double radius;
|
private double radius;
|
||||||
|
@ -35,8 +38,8 @@ public class EarthPillars extends EarthAbility implements ComboAbility {
|
||||||
private boolean firstTime;
|
private boolean firstTime;
|
||||||
private Map<RaiseEarth, LivingEntity> entities;
|
private Map<RaiseEarth, LivingEntity> entities;
|
||||||
|
|
||||||
public EarthPillars(final Player player, final boolean fall) {
|
public EarthPillars(final EarthPillarsConfig config, final Player player, final boolean fall) {
|
||||||
super(player);
|
super(config, player);
|
||||||
this.setFields(fall);
|
this.setFields(fall);
|
||||||
|
|
||||||
if (!this.bPlayer.canBendIgnoreBinds(this) || !isEarthbendable(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType(), true, true, false)) {
|
if (!this.bPlayer.canBendIgnoreBinds(this) || !isEarthbendable(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType(), true, true, false)) {
|
||||||
|
@ -55,14 +58,14 @@ public class EarthPillars extends EarthAbility implements ComboAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setFields(final boolean fall) {
|
private void setFields(final boolean fall) {
|
||||||
this.radius = getConfig().getDouble("Abilities.Earth.EarthPillars.Radius");
|
this.radius = config.Radius;
|
||||||
this.damage = getConfig().getDouble("Abilities.Earth.EarthPillars.Damage.Value");
|
this.damage = config.Damage;
|
||||||
this.knockup = getConfig().getDouble("Abilities.Earth.EarthPillars.Knockup");
|
this.knockup = config.Knockup;
|
||||||
this.damaging = getConfig().getBoolean("Abilities.Earth.EarthPillars.Damage.Enabled");
|
this.damaging = config.DealsDamage;
|
||||||
this.entities = new HashMap<>();
|
this.entities = new HashMap<>();
|
||||||
|
|
||||||
if (fall) {
|
if (fall) {
|
||||||
this.fallThreshold = getConfig().getDouble("Abilities.Earth.EarthPillars.FallThreshold");
|
this.fallThreshold = config.FallHeightThreshold;
|
||||||
this.damaging = true;
|
this.damaging = true;
|
||||||
this.damage *= this.knockup;
|
this.damage *= this.knockup;
|
||||||
this.radius = this.fallThreshold;
|
this.radius = this.fallThreshold;
|
||||||
|
@ -71,7 +74,7 @@ public class EarthPillars extends EarthAbility implements ComboAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void affect(final LivingEntity lent) {
|
public void affect(final LivingEntity lent) {
|
||||||
final RaiseEarth re = new RaiseEarth(this.player, lent.getLocation().clone().subtract(0, 1, 0), 3);
|
final RaiseEarth re = new RaiseEarth(ConfigManager.getConfig(RaiseEarthConfig.class), this.player, lent.getLocation().clone().subtract(0, 1, 0), 3);
|
||||||
this.entities.put(re, lent);
|
this.entities.put(re, lent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +137,7 @@ public class EarthPillars extends EarthAbility implements ComboAbility {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getCooldown() {
|
public long getCooldown() {
|
||||||
return getConfig().getLong("Abilities.Earth.EarthPillars.Cooldown");
|
return config.Cooldown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -149,7 +152,7 @@ public class EarthPillars extends EarthAbility implements ComboAbility {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object createNewComboInstance(final Player player) {
|
public Object createNewComboInstance(final Player player) {
|
||||||
return new EarthPillars(player, false);
|
return new EarthPillars(ConfigManager.getConfig(EarthPillarsConfig.class), player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,13 +20,15 @@ import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.ability.LavaAbility;
|
import com.projectkorra.projectkorra.ability.LavaAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.LavaFlowConfig;
|
||||||
import com.projectkorra.projectkorra.util.BlockSource;
|
import com.projectkorra.projectkorra.util.BlockSource;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
import com.projectkorra.projectkorra.util.Information;
|
import com.projectkorra.projectkorra.util.Information;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public class LavaFlow extends LavaAbility {
|
@SuppressWarnings("deprecation")
|
||||||
|
public class LavaFlow extends LavaAbility<LavaFlowConfig> {
|
||||||
|
|
||||||
public static enum AbilityType {
|
public static enum AbilityType {
|
||||||
SHIFT, CLICK
|
SHIFT, CLICK
|
||||||
|
@ -89,8 +91,8 @@ public class LavaFlow extends LavaAbility {
|
||||||
* @param player the player that bended the ability
|
* @param player the player that bended the ability
|
||||||
* @param type either shift or sneak
|
* @param type either shift or sneak
|
||||||
*/
|
*/
|
||||||
public LavaFlow(final Player player, final AbilityType type) {
|
public LavaFlow(final LavaFlowConfig config, final Player player, final AbilityType type) {
|
||||||
super(player);
|
super(config, player);
|
||||||
if (!this.bPlayer.canLavabend()) {
|
if (!this.bPlayer.canLavabend()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -106,37 +108,37 @@ public class LavaFlow extends LavaAbility {
|
||||||
this.clickIsFinished = false;
|
this.clickIsFinished = false;
|
||||||
this.affectedBlocks = new ArrayList<TempBlock>();
|
this.affectedBlocks = new ArrayList<TempBlock>();
|
||||||
this.tasks = new ArrayList<BukkitRunnable>();
|
this.tasks = new ArrayList<BukkitRunnable>();
|
||||||
this.revertMaterial = Material.getMaterial(getConfig().getString("Abilities.Earth.LavaFlow.RevertMaterial"));
|
this.revertMaterial = config.RevertMaterial;
|
||||||
|
|
||||||
this.shiftCooldown = getConfig().getLong("Abilities.Earth.LavaFlow.ShiftCooldown");
|
this.shiftCooldown = config.ShiftCooldown;
|
||||||
this.shiftPlatformRadius = getConfig().getDouble("Abilities.Earth.LavaFlow.ShiftPlatformRadius");
|
this.shiftPlatformRadius = config.ShiftPlatformRadius;
|
||||||
this.shiftMaxRadius = getConfig().getDouble("Abilities.Earth.LavaFlow.ShiftRadius");
|
this.shiftMaxRadius = config.ShiftRadius;
|
||||||
this.shiftFlowSpeed = getConfig().getDouble("Abilities.Earth.LavaFlow.ShiftFlowSpeed");
|
this.shiftFlowSpeed = config.ShiftFlowSpeed;
|
||||||
this.shiftRemoveSpeed = getConfig().getDouble("Abilities.Earth.LavaFlow.ShiftRemoveSpeed");
|
this.shiftRemoveSpeed = config.ShiftRemoveSpeed;
|
||||||
this.shiftRemoveDelay = getConfig().getLong("Abilities.Earth.LavaFlow.ShiftCleanupDelay");
|
this.shiftRemoveDelay = config.ShiftCleanupDelay;
|
||||||
this.particleDensity = getConfig().getDouble("Abilities.Earth.LavaFlow.ParticleDensity");
|
this.particleDensity = config.ParticleDensity;
|
||||||
this.clickRange = getConfig().getDouble("Abilities.Earth.LavaFlow.ClickRange");
|
this.clickRange = config.ClickRange;
|
||||||
this.clickLavaRadius = getConfig().getDouble("Abilities.Earth.LavaFlow.ClickRadius");
|
this.clickLavaRadius = config.ClickRadius;
|
||||||
this.clickLandRadius = getConfig().getDouble("Abilities.Earth.LavaFlow.ClickRadius");
|
this.clickLandRadius = config.ClickRadius;
|
||||||
this.clickLavaDelay = getConfig().getLong("Abilities.Earth.LavaFlow.ClickLavaStartDelay");
|
this.clickLavaDelay = config.ClickLavaStartDelay;
|
||||||
this.clickLandDelay = getConfig().getLong("Abilities.Earth.LavaFlow.ClickLandStartDelay");
|
this.clickLandDelay = config.ClickLandStartDelay;
|
||||||
this.clickLavaCooldown = getConfig().getLong("Abilities.Earth.LavaFlow.ClickLavaCooldown");
|
this.clickLavaCooldown = config.ClickLavaCooldown;
|
||||||
this.clickLandCooldown = getConfig().getLong("Abilities.Earth.LavaFlow.ClickLandCooldown");
|
this.clickLandCooldown = config.ClickLandCooldown;
|
||||||
this.clickLavaCleanupDelay = getConfig().getLong("Abilities.Earth.LavaFlow.ClickLavaCleanupDelay");
|
this.clickLavaCleanupDelay = config.ClickLavaCleanupDelay;
|
||||||
this.clickLandCleanupDelay = getConfig().getLong("Abilities.Earth.LavaFlow.ClickLandCleanupDelay");
|
this.clickLandCleanupDelay = config.ClickLandCleanupDelay;
|
||||||
this.lavaCreateSpeed = getConfig().getDouble("Abilities.Earth.LavaFlow.ClickLavaCreateSpeed");
|
this.lavaCreateSpeed = config.ClickLavaCreateSpeed;
|
||||||
this.landCreateSpeed = getConfig().getDouble("Abilities.Earth.LavaFlow.ClickLandCreateSpeed");
|
this.landCreateSpeed = config.ClickLandCreateSpeed;
|
||||||
this.upwardFlow = getConfig().getInt("Abilities.Earth.LavaFlow.UpwardFlow");
|
this.upwardFlow = config.UpwardFlow;
|
||||||
this.downwardFlow = getConfig().getInt("Abilities.Earth.LavaFlow.DownwardFlow");
|
this.downwardFlow = config.DownwardFlow;
|
||||||
this.allowNaturalFlow = getConfig().getBoolean("Abilities.Earth.LavaFlow.AllowNaturalFlow");
|
this.allowNaturalFlow = config.AllowNaturalFlow;
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.shiftCooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.LavaFlow.ShiftCooldown");
|
this.shiftCooldown = config.AvatarState_ShiftCooldown;
|
||||||
this.clickLavaCooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.LavaFlow.ClickLavaCooldown");
|
this.clickLavaCooldown = config.AvatarState_ClickLavaCooldown;
|
||||||
this.clickLandCooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.LavaFlow.ClickLandCooldown");
|
this.clickLandCooldown = config.AvatarState_ClickLandCooldown;
|
||||||
this.shiftPlatformRadius = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.LavaFlow.ShiftPlatformRadius");
|
this.shiftPlatformRadius = config.AvatarState_ShiftPlatformRadius;
|
||||||
this.clickLavaRadius = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.LavaFlow.ClickRadius");
|
this.clickLavaRadius = config.AvatarState_ClickRadius;
|
||||||
this.shiftMaxRadius = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.LavaFlow.ShiftRadius");
|
this.shiftMaxRadius = config.AvatarState_ShiftRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == AbilityType.SHIFT) {
|
if (type == AbilityType.SHIFT) {
|
||||||
|
|
|
@ -1,471 +0,0 @@
|
||||||
package com.projectkorra.projectkorra.earthbending.lava;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ListIterator;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.FallingBlock;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
|
||||||
import com.projectkorra.projectkorra.ability.LavaAbility;
|
|
||||||
import com.projectkorra.projectkorra.util.BlockSource;
|
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
|
||||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
|
||||||
|
|
||||||
public class LavaSurge extends LavaAbility {
|
|
||||||
|
|
||||||
private static final HashSet<FallingBlock> ALL_FALLING_BLOCKS = new HashSet<>();
|
|
||||||
|
|
||||||
private boolean hasSurgeStarted;
|
|
||||||
private boolean isFractureOpen;
|
|
||||||
private boolean canSourceBeEarth;
|
|
||||||
private int fallingBlocksCount;
|
|
||||||
private int maxBlocks;
|
|
||||||
private int particleInterval;
|
|
||||||
private int fallingBlockInterval;
|
|
||||||
private long time;
|
|
||||||
private long lastTime;
|
|
||||||
private long cooldown;
|
|
||||||
private double impactDamage;
|
|
||||||
private double fractureRadius;
|
|
||||||
private double prepareRange;
|
|
||||||
private double travelRange;
|
|
||||||
private Block sourceBlock;
|
|
||||||
private Random random;
|
|
||||||
private Vector direction;
|
|
||||||
private Location startLocation;
|
|
||||||
private ArrayList<FallingBlock> fallingBlocks;
|
|
||||||
private ArrayList<Block> fracture;
|
|
||||||
private ArrayList<TempBlock> fractureTempBlocks;
|
|
||||||
private ArrayList<TempBlock> movingLava;
|
|
||||||
private Map<FallingBlock, TempBlock> lavaBlocks;
|
|
||||||
private ListIterator<Block> listIterator;
|
|
||||||
|
|
||||||
public LavaSurge(final Player player) {
|
|
||||||
super(player);
|
|
||||||
|
|
||||||
this.impactDamage = getConfig().getInt("Abilities.Earth.LavaSurge.Damage");
|
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.LavaSurge.Cooldown");
|
|
||||||
this.fractureRadius = getConfig().getDouble("Abilities.Earth.LavaSurge.FractureRadius");
|
|
||||||
this.prepareRange = getConfig().getInt("Abilities.Earth.LavaSurge.PrepareRange");
|
|
||||||
this.travelRange = getConfig().getInt("Abilities.Earth.LavaSurge.TravelRange");
|
|
||||||
this.maxBlocks = getConfig().getInt("Abilities.Earth.LavaSurge.MaxLavaWaves");
|
|
||||||
this.canSourceBeEarth = getConfig().getBoolean("Abilities.Earth.LavaSurge.SourceCanBeEarth");
|
|
||||||
this.particleInterval = 100;
|
|
||||||
this.fallingBlockInterval = 100;
|
|
||||||
|
|
||||||
this.random = new Random();
|
|
||||||
this.fallingBlocks = new ArrayList<>();
|
|
||||||
this.fracture = new ArrayList<>();
|
|
||||||
this.fractureTempBlocks = new ArrayList<>();
|
|
||||||
this.movingLava = new ArrayList<>();
|
|
||||||
this.lavaBlocks = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
if (!this.isEligible()) {
|
|
||||||
return;
|
|
||||||
} else if (this.bPlayer.isOnCooldown(this)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.lastTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
if (this.prepare()) {
|
|
||||||
this.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEligible() {
|
|
||||||
return this.bPlayer.canBend(this) && this.bPlayer.canLavabend();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean prepare() {
|
|
||||||
final Block targetBlock = BlockSource.getEarthSourceBlock(this.player, this.prepareRange, ClickType.SHIFT_DOWN);
|
|
||||||
|
|
||||||
if (targetBlock == null || !(ElementalAbility.isAir(targetBlock.getRelative(BlockFace.UP).getType())) && !isLava(targetBlock.getRelative(BlockFace.UP))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final LavaSurge otherSurge = getAbility(this.player, this.getClass());
|
|
||||||
if (otherSurge != null) {
|
|
||||||
otherSurge.revertFracture();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((this.canSourceBeEarth && this.isEarthbendable(targetBlock)) || this.isLavabendable(targetBlock)) {
|
|
||||||
this.startLocation = targetBlock.getLocation().add(0, 1, 0);
|
|
||||||
this.sourceBlock = targetBlock;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void launch() {
|
|
||||||
Location targetLocation = GeneralMethods.getTargetedLocation(this.player, this.travelRange * 2);
|
|
||||||
|
|
||||||
try {
|
|
||||||
targetLocation = GeneralMethods.getTargetedEntity(this.player, this.travelRange * 2, null).getLocation();
|
|
||||||
} catch (final NullPointerException e) {}
|
|
||||||
|
|
||||||
if (targetLocation == null) {
|
|
||||||
this.remove();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.time = System.currentTimeMillis();
|
|
||||||
this.direction = GeneralMethods.getDirection(this.startLocation, targetLocation).multiply(0.07);
|
|
||||||
|
|
||||||
if (this.direction.getY() < 0) {
|
|
||||||
this.direction.setY(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.canSourceBeEarth) {
|
|
||||||
this.openFracture();
|
|
||||||
} else {
|
|
||||||
this.skipFracture();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openFracture() {
|
|
||||||
final List<Block> affectedBlocks = GeneralMethods.getBlocksAroundPoint(this.sourceBlock.getLocation(), this.fractureRadius);
|
|
||||||
|
|
||||||
for (final Block b : affectedBlocks) {
|
|
||||||
if (this.isEarthbendable(b)) {
|
|
||||||
this.fracture.add(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.listIterator = this.fracture.listIterator();
|
|
||||||
this.isFractureOpen = true;
|
|
||||||
this.bPlayer.addCooldown(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void skipFracture() {
|
|
||||||
this.listIterator = this.fracture.listIterator();
|
|
||||||
this.isFractureOpen = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void revertFracture() {
|
|
||||||
for (final TempBlock tb : this.fractureTempBlocks) {
|
|
||||||
tb.revertBlock();
|
|
||||||
}
|
|
||||||
this.fracture.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void remove() {
|
|
||||||
super.remove();
|
|
||||||
this.revertFracture();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canMoveThrough(final Block block) {
|
|
||||||
if (this.isTransparent(this.startLocation.getBlock()) || this.isEarthbendable(this.startLocation.getBlock()) || this.isLavabendable(this.startLocation.getBlock())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeLava() {
|
|
||||||
for (final TempBlock tb : this.lavaBlocks.values()) {
|
|
||||||
tb.revertBlock();
|
|
||||||
}
|
|
||||||
this.movingLava.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void progress() {
|
|
||||||
final long curTime = System.currentTimeMillis();
|
|
||||||
if (!this.player.isOnline() || this.player.isDead()) {
|
|
||||||
this.remove();
|
|
||||||
return;
|
|
||||||
} else if (!this.hasSurgeStarted && !this.bPlayer.getBoundAbilityName().equals(this.getName())) {
|
|
||||||
this.remove();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.hasSurgeStarted && this.sourceBlock != null && curTime > this.lastTime + this.particleInterval) {
|
|
||||||
this.lastTime = curTime;
|
|
||||||
ParticleEffect.LAVA.display(this.sourceBlock.getLocation(), 0, 0, 0, 0, 1);
|
|
||||||
} else if (this.hasSurgeStarted && curTime > this.lastTime + this.particleInterval) {
|
|
||||||
this.lastTime = curTime;
|
|
||||||
for (final FallingBlock fblock : this.fallingBlocks) {
|
|
||||||
ParticleEffect.LAVA.display(fblock.getLocation(), 0, 0, 0, 0, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isFractureOpen && !this.hasSurgeStarted) {
|
|
||||||
if (!this.listIterator.hasNext()) {
|
|
||||||
this.hasSurgeStarted = true;
|
|
||||||
} else {
|
|
||||||
final Block b = this.listIterator.next();
|
|
||||||
playEarthbendingSound(b.getLocation());
|
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
|
||||||
final TempBlock tb = new TempBlock(b, Material.LAVA, GeneralMethods.getLavaData(0));
|
|
||||||
this.fractureTempBlocks.add(tb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.hasSurgeStarted) {
|
|
||||||
if (this.fallingBlocksCount >= this.maxBlocks) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (curTime > this.time + (this.fallingBlockInterval * this.fallingBlocksCount)) {
|
|
||||||
final FallingBlock fbs = GeneralMethods.spawnFallingBlock(this.sourceBlock.getLocation().add(0, 1, 0), Material.MAGMA_BLOCK, Material.MAGMA_BLOCK.createBlockData());
|
|
||||||
this.fallingBlocks.add(fbs);
|
|
||||||
ALL_FALLING_BLOCKS.add(fbs);
|
|
||||||
double x = this.random.nextDouble() / 5;
|
|
||||||
double z = this.random.nextDouble() / 5;
|
|
||||||
|
|
||||||
x = (this.random.nextBoolean()) ? -x : x;
|
|
||||||
z = (this.random.nextBoolean()) ? -z : z;
|
|
||||||
|
|
||||||
fbs.setVelocity(this.direction.clone().add(new Vector(x, 0.2, z)).multiply(1.2));
|
|
||||||
fbs.setDropItem(false);
|
|
||||||
|
|
||||||
for (final Block b : this.fracture) {
|
|
||||||
if (this.random.nextBoolean() && b != this.sourceBlock) {
|
|
||||||
final FallingBlock fb = GeneralMethods.spawnFallingBlock(b.getLocation().add(new Vector(0, 1, 0)), Material.MAGMA_BLOCK, Material.MAGMA_BLOCK.createBlockData());
|
|
||||||
ALL_FALLING_BLOCKS.add(fb);
|
|
||||||
this.fallingBlocks.add(fb);
|
|
||||||
fb.setVelocity(this.direction.clone().add(new Vector(this.random.nextDouble() / 10, 0.1, this.random.nextDouble() / 10)).multiply(1.2));
|
|
||||||
fb.setDropItem(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fallingBlocksCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final FallingBlock fb : this.fallingBlocks) {
|
|
||||||
for (final Entity e : GeneralMethods.getEntitiesAroundPoint(fb.getLocation(), 2)) {
|
|
||||||
if (e instanceof LivingEntity) {
|
|
||||||
if (e.getEntityId() != this.player.getEntityId()) {
|
|
||||||
DamageHandler.damageEntity(e, this.impactDamage, this);
|
|
||||||
e.setFireTicks(100);
|
|
||||||
GeneralMethods.setVelocity(e, this.direction.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "LavaSurge";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location getLocation() {
|
|
||||||
return this.startLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getCooldown() {
|
|
||||||
return this.cooldown;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSneakAbility() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHarmlessAbility() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHiddenAbility() {
|
|
||||||
return true; // disabled
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HashSet<FallingBlock> getAllFallingBlocks() {
|
|
||||||
return ALL_FALLING_BLOCKS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isHasSurgeStarted() {
|
|
||||||
return this.hasSurgeStarted;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHasSurgeStarted(final boolean hasSurgeStarted) {
|
|
||||||
this.hasSurgeStarted = hasSurgeStarted;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFractureOpen() {
|
|
||||||
return this.isFractureOpen;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFractureOpen(final boolean isFractureOpen) {
|
|
||||||
this.isFractureOpen = isFractureOpen;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCanSourceBeEarth() {
|
|
||||||
return this.canSourceBeEarth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCanSourceBeEarth(final boolean canSourceBeEarth) {
|
|
||||||
this.canSourceBeEarth = canSourceBeEarth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFallingBlocksCount() {
|
|
||||||
return this.fallingBlocksCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFallingBlocksCount(final int fallingBlocksCount) {
|
|
||||||
this.fallingBlocksCount = fallingBlocksCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaxBlocks() {
|
|
||||||
return this.maxBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxBlocks(final int maxBlocks) {
|
|
||||||
this.maxBlocks = maxBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getParticleInterval() {
|
|
||||||
return this.particleInterval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParticleInterval(final int particleInterval) {
|
|
||||||
this.particleInterval = particleInterval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFallingBlockInterval() {
|
|
||||||
return this.fallingBlockInterval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFallingBlockInterval(final int fallingBlockInterval) {
|
|
||||||
this.fallingBlockInterval = fallingBlockInterval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTime() {
|
|
||||||
return this.time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTime(final long time) {
|
|
||||||
this.time = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getLastTime() {
|
|
||||||
return this.lastTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastTime(final long lastTime) {
|
|
||||||
this.lastTime = lastTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getImpactDamage() {
|
|
||||||
return this.impactDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImpactDamage(final double impactDamage) {
|
|
||||||
this.impactDamage = impactDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getFractureRadius() {
|
|
||||||
return this.fractureRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFractureRadius(final double fractureRadius) {
|
|
||||||
this.fractureRadius = fractureRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getPrepareRange() {
|
|
||||||
return this.prepareRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrepareRange(final double prepareRange) {
|
|
||||||
this.prepareRange = prepareRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getTravelRange() {
|
|
||||||
return this.travelRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTravelRange(final double travelRange) {
|
|
||||||
this.travelRange = travelRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Block getSourceBlock() {
|
|
||||||
return this.sourceBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSourceBlock(final Block sourceBlock) {
|
|
||||||
this.sourceBlock = sourceBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Random getRandom() {
|
|
||||||
return this.random;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRandom(final Random random) {
|
|
||||||
this.random = random;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector getDirection() {
|
|
||||||
return this.direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDirection(final Vector direction) {
|
|
||||||
this.direction = direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getStartLocation() {
|
|
||||||
return this.startLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStartLocation(final Location startLocation) {
|
|
||||||
this.startLocation = startLocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ListIterator<Block> getListIterator() {
|
|
||||||
return this.listIterator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setListIterator(final ListIterator<Block> listIterator) {
|
|
||||||
this.listIterator = listIterator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<FallingBlock> getFallingBlocks() {
|
|
||||||
return this.fallingBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<Block> getFracture() {
|
|
||||||
return this.fracture;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<TempBlock> getFractureTempBlocks() {
|
|
||||||
return this.fractureTempBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<TempBlock> getMovingLava() {
|
|
||||||
return this.movingLava;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<FallingBlock, TempBlock> getLavaBlocks() {
|
|
||||||
return this.lavaBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCooldown(final long cooldown) {
|
|
||||||
this.cooldown = cooldown;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,466 +0,0 @@
|
||||||
package com.projectkorra.projectkorra.earthbending.lava;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
|
||||||
import com.projectkorra.projectkorra.ability.LavaAbility;
|
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
|
||||||
import com.projectkorra.projectkorra.firebending.FireBlast;
|
|
||||||
import com.projectkorra.projectkorra.util.BlockSource;
|
|
||||||
import com.projectkorra.projectkorra.util.BlockSource.BlockSourceType;
|
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
|
||||||
|
|
||||||
public class LavaSurgeWall extends LavaAbility {
|
|
||||||
|
|
||||||
private static final Map<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<Block, Block>();
|
|
||||||
private static final Map<Block, Player> WALL_BLOCKS = new ConcurrentHashMap<Block, Player>();
|
|
||||||
private static final int SURGE_WAVE_RANGE = 20;
|
|
||||||
|
|
||||||
private boolean progressing;
|
|
||||||
private boolean settingUp;
|
|
||||||
private boolean forming;
|
|
||||||
private long time;
|
|
||||||
private long interval;
|
|
||||||
private long cooldown;
|
|
||||||
private double radius;
|
|
||||||
private double range;
|
|
||||||
private Block sourceBlock;
|
|
||||||
private Location location;
|
|
||||||
private Location firstDestination;
|
|
||||||
private Location targetDestination;
|
|
||||||
private Vector firstDirection;
|
|
||||||
private Vector targetDirection;
|
|
||||||
|
|
||||||
public LavaSurgeWall(final Player player) {
|
|
||||||
super(player);
|
|
||||||
|
|
||||||
this.interval = 30;
|
|
||||||
this.radius = getConfig().getDouble("Abilities.Water.Surge.Wall.Radius");
|
|
||||||
this.range = getConfig().getDouble("Abilities.Water.Surge.Wall.Range");
|
|
||||||
this.cooldown = GeneralMethods.getGlobalCooldown();
|
|
||||||
|
|
||||||
final LavaSurgeWave wave = getAbility(player, LavaSurgeWave.class);
|
|
||||||
if (wave != null && wave.isProgressing()) {
|
|
||||||
LavaSurgeWave.launch(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
|
||||||
this.radius = AvatarState.getValue(this.radius);
|
|
||||||
this.range = AvatarState.getValue(this.range);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.bPlayer.canBend(this)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean prepare() {
|
|
||||||
this.cancelPrevious();
|
|
||||||
final Block block = BlockSource.getSourceBlock(this.player, this.range, BlockSourceType.LAVA, ClickType.LEFT_CLICK);
|
|
||||||
if (block != null) {
|
|
||||||
this.sourceBlock = block;
|
|
||||||
this.focusBlock();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cancelPrevious() {
|
|
||||||
final LavaSurgeWall lavaWall = getAbility(this.player, LavaSurgeWall.class);
|
|
||||||
if (lavaWall != null) {
|
|
||||||
if (lavaWall.progressing) {
|
|
||||||
lavaWall.removeLava(lavaWall.sourceBlock);
|
|
||||||
} else {
|
|
||||||
lavaWall.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void cancel() {
|
|
||||||
this.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void focusBlock() {
|
|
||||||
this.location = this.sourceBlock.getLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void moveLava() {
|
|
||||||
if (this.sourceBlock != null) {
|
|
||||||
this.targetDestination = this.getTargetEarthBlock((int) this.range).getLocation();
|
|
||||||
|
|
||||||
if (this.targetDestination.distanceSquared(this.location) <= 1) {
|
|
||||||
this.progressing = false;
|
|
||||||
this.targetDestination = null;
|
|
||||||
} else {
|
|
||||||
this.progressing = true;
|
|
||||||
this.settingUp = true;
|
|
||||||
this.firstDestination = this.getToEyeLevel();
|
|
||||||
this.firstDirection = this.getDirection(this.sourceBlock.getLocation(), this.firstDestination);
|
|
||||||
this.targetDirection = this.getDirection(this.firstDestination, this.targetDestination);
|
|
||||||
|
|
||||||
if (!GeneralMethods.isAdjacentToThreeOrMoreSources(this.sourceBlock)) {
|
|
||||||
this.sourceBlock.setType(Material.AIR);
|
|
||||||
}
|
|
||||||
this.addLava(this.sourceBlock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Location getToEyeLevel() {
|
|
||||||
final Location loc = this.sourceBlock.getLocation().clone();
|
|
||||||
loc.setY(this.targetDestination.getY());
|
|
||||||
return loc;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Vector getDirection(final Location location, final Location destination) {
|
|
||||||
double x1, y1, z1;
|
|
||||||
double x0, y0, z0;
|
|
||||||
x1 = destination.getX();
|
|
||||||
y1 = destination.getY();
|
|
||||||
z1 = destination.getZ();
|
|
||||||
x0 = location.getX();
|
|
||||||
y0 = location.getY();
|
|
||||||
z0 = location.getZ();
|
|
||||||
return new Vector(x1 - x0, y1 - y0, z1 - z0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void progress() {
|
|
||||||
if (!this.bPlayer.canBendIgnoreCooldowns(this)) {
|
|
||||||
if (!this.forming) {
|
|
||||||
this.breakBlock();
|
|
||||||
}
|
|
||||||
this.remove();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (System.currentTimeMillis() - this.time >= this.interval) {
|
|
||||||
this.time = System.currentTimeMillis();
|
|
||||||
if (this.progressing && !this.player.isSneaking()) {
|
|
||||||
this.remove();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.progressing) {
|
|
||||||
this.sourceBlock.getWorld().playEffect(this.location, Effect.SMOKE, 4, (int) this.range);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.forming) {
|
|
||||||
final ArrayList<Block> blocks = new ArrayList<Block>();
|
|
||||||
final Location loc = GeneralMethods.getTargetedLocation(this.player, (int) this.range, Material.WATER, Material.ICE);
|
|
||||||
this.location = loc.clone();
|
|
||||||
final Vector dir = this.player.getEyeLocation().getDirection();
|
|
||||||
Vector vec;
|
|
||||||
Block block;
|
|
||||||
|
|
||||||
for (double i = 0; i <= this.radius; i += 0.5) {
|
|
||||||
for (double angle = 0; angle < 360; angle += 10) {
|
|
||||||
vec = GeneralMethods.getOrthogonalVector(dir.clone(), angle, i);
|
|
||||||
block = loc.clone().add(vec).getBlock();
|
|
||||||
|
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this.player, "LavaSurge", block.getLocation())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (WALL_BLOCKS.containsKey(block)) {
|
|
||||||
blocks.add(block);
|
|
||||||
} else if (!blocks.contains(block) && (ElementalAbility.isAir(block.getType()) || block.getType() == Material.FIRE || this.isLavabendable(block))) {
|
|
||||||
WALL_BLOCKS.put(block, this.player);
|
|
||||||
this.addWallBlock(block);
|
|
||||||
blocks.add(block);
|
|
||||||
FireBlast.removeFireBlastsAroundPoint(block.getLocation(), 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Block blocki : WALL_BLOCKS.keySet()) {
|
|
||||||
if (WALL_BLOCKS.get(blocki) == this.player && !blocks.contains(blocki)) {
|
|
||||||
finalRemoveLava(blocki);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.sourceBlock.getLocation().distanceSquared(this.firstDestination) < 0.5 * 0.5 && this.settingUp) {
|
|
||||||
this.settingUp = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector direction;
|
|
||||||
if (this.settingUp) {
|
|
||||||
direction = this.firstDirection;
|
|
||||||
} else {
|
|
||||||
direction = this.targetDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.location = this.location.clone().add(direction);
|
|
||||||
Block block = this.location.getBlock();
|
|
||||||
if (block.getLocation().equals(this.sourceBlock.getLocation())) {
|
|
||||||
this.location = this.location.clone().add(direction);
|
|
||||||
block = this.location.getBlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ElementalAbility.isAir(block.getType())) {
|
|
||||||
this.breakBlock();
|
|
||||||
return;
|
|
||||||
} else if (!this.progressing) {
|
|
||||||
this.breakBlock();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.addLava(block);
|
|
||||||
this.removeLava(this.sourceBlock);
|
|
||||||
this.sourceBlock = block;
|
|
||||||
if (this.location.distanceSquared(this.targetDestination) < 1) {
|
|
||||||
this.removeLava(this.sourceBlock);
|
|
||||||
this.forming = true;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addWallBlock(final Block block) {
|
|
||||||
new TempBlock(block, Material.LAVA, GeneralMethods.getLavaData(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void breakBlock() {
|
|
||||||
finalRemoveLava(this.sourceBlock);
|
|
||||||
for (final Block block : WALL_BLOCKS.keySet()) {
|
|
||||||
if (WALL_BLOCKS.get(block) == this.player) {
|
|
||||||
finalRemoveLava(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void removeLava(final Block block) {
|
|
||||||
if (block != null) {
|
|
||||||
if (AFFECTED_BLOCKS.containsKey(block)) {
|
|
||||||
if (!GeneralMethods.isAdjacentToThreeOrMoreSources(block)) {
|
|
||||||
TempBlock.revertBlock(block, Material.AIR);
|
|
||||||
}
|
|
||||||
AFFECTED_BLOCKS.remove(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void finalRemoveLava(final Block block) {
|
|
||||||
if (AFFECTED_BLOCKS.containsKey(block)) {
|
|
||||||
TempBlock.revertBlock(block, Material.AIR);
|
|
||||||
AFFECTED_BLOCKS.remove(block);
|
|
||||||
}
|
|
||||||
if (WALL_BLOCKS.containsKey(block)) {
|
|
||||||
TempBlock.revertBlock(block, Material.AIR);
|
|
||||||
WALL_BLOCKS.remove(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addLava(final Block block) {
|
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this.player, "LavaSurge", block.getLocation())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!TempBlock.isTempBlock(block)) {
|
|
||||||
new TempBlock(block, Material.LAVA, GeneralMethods.getLavaData(0));
|
|
||||||
AFFECTED_BLOCKS.put(block, block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void moveLava(final Player player) {
|
|
||||||
final LavaSurgeWall wall = getAbility(player, LavaSurgeWall.class);
|
|
||||||
if (wall != null) {
|
|
||||||
wall.moveLava();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void form(final Player player) {
|
|
||||||
if (!hasAbility(player, LavaSurgeWall.class)) {
|
|
||||||
new LavaSurgeWave(player);
|
|
||||||
return;
|
|
||||||
} else if (isLavabendable(player, player.getTargetBlock((HashSet<Material>) null, SURGE_WAVE_RANGE))) {
|
|
||||||
new LavaSurgeWave(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
moveLava(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void cleanup() {
|
|
||||||
for (final Block block : AFFECTED_BLOCKS.keySet()) {
|
|
||||||
TempBlock.revertBlock(block, Material.AIR);
|
|
||||||
AFFECTED_BLOCKS.remove(block);
|
|
||||||
WALL_BLOCKS.remove(block);
|
|
||||||
}
|
|
||||||
for (final Block block : WALL_BLOCKS.keySet()) {
|
|
||||||
TempBlock.revertBlock(block, Material.AIR);
|
|
||||||
AFFECTED_BLOCKS.remove(block);
|
|
||||||
WALL_BLOCKS.remove(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean wasBrokenFor(final Player player, final Block block) {
|
|
||||||
final LavaSurgeWall wall = getAbility(player, LavaSurgeWall.class);
|
|
||||||
if (wall != null) {
|
|
||||||
if (wall.sourceBlock == null) {
|
|
||||||
return false;
|
|
||||||
} else if (wall.sourceBlock.equals(block)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Map<Block, Block> getAffectedBlocks() {
|
|
||||||
return AFFECTED_BLOCKS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Map<Block, Player> getWallBlocks() {
|
|
||||||
return WALL_BLOCKS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "LavaSurgeWall";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location getLocation() {
|
|
||||||
return this.location;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getCooldown() {
|
|
||||||
return this.cooldown;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSneakAbility() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHarmlessAbility() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHiddenAbility() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isProgressing() {
|
|
||||||
return this.progressing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProgressing(final boolean progressing) {
|
|
||||||
this.progressing = progressing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSettingUp() {
|
|
||||||
return this.settingUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSettingUp(final boolean settingUp) {
|
|
||||||
this.settingUp = settingUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isForming() {
|
|
||||||
return this.forming;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setForming(final boolean forming) {
|
|
||||||
this.forming = forming;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTime() {
|
|
||||||
return this.time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTime(final long time) {
|
|
||||||
this.time = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getInterval() {
|
|
||||||
return this.interval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInterval(final long interval) {
|
|
||||||
this.interval = interval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getRadius() {
|
|
||||||
return this.radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRadius(final double radius) {
|
|
||||||
this.radius = radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getRange() {
|
|
||||||
return this.range;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRange(final double range) {
|
|
||||||
this.range = range;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Block getSourceBlock() {
|
|
||||||
return this.sourceBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSourceBlock(final Block sourceBlock) {
|
|
||||||
this.sourceBlock = sourceBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getFirstDestination() {
|
|
||||||
return this.firstDestination;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFirstDestination(final Location firstDestination) {
|
|
||||||
this.firstDestination = firstDestination;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getTargetDestination() {
|
|
||||||
return this.targetDestination;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTargetDestination(final Location targetDestination) {
|
|
||||||
this.targetDestination = targetDestination;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector getFirstDirection() {
|
|
||||||
return this.firstDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFirstDirection(final Vector firstDirection) {
|
|
||||||
this.firstDirection = firstDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector getTargetDirection() {
|
|
||||||
return this.targetDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTargetDirection(final Vector targetDirection) {
|
|
||||||
this.targetDirection = targetDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCooldown(final long cooldown) {
|
|
||||||
this.cooldown = cooldown;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocation(final Location location) {
|
|
||||||
this.location = location;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,441 +0,0 @@
|
||||||
package com.projectkorra.projectkorra.earthbending.lava;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
|
||||||
import com.projectkorra.projectkorra.ability.LavaAbility;
|
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
|
||||||
import com.projectkorra.projectkorra.firebending.FireBlast;
|
|
||||||
import com.projectkorra.projectkorra.util.BlockSource;
|
|
||||||
import com.projectkorra.projectkorra.util.BlockSource.BlockSourceType;
|
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
|
||||||
|
|
||||||
public class LavaSurgeWave extends LavaAbility {
|
|
||||||
|
|
||||||
private boolean progressing;
|
|
||||||
private boolean canHitSelf;
|
|
||||||
private long time;
|
|
||||||
private long cooldown;
|
|
||||||
private double range;
|
|
||||||
private double radius;
|
|
||||||
private double maxRadius;
|
|
||||||
private double horizontalPush;
|
|
||||||
private double verticalPush;
|
|
||||||
private double interval;
|
|
||||||
private Location location;
|
|
||||||
private Block sourceBlock;
|
|
||||||
private Location targetDestination;
|
|
||||||
private Vector targetDirection;
|
|
||||||
private final ConcurrentHashMap<Block, Block> waveBlocks;
|
|
||||||
private final ConcurrentHashMap<Block, Block> frozenBlocks;
|
|
||||||
|
|
||||||
public LavaSurgeWave(final Player player) {
|
|
||||||
super(player);
|
|
||||||
|
|
||||||
this.progressing = false;
|
|
||||||
this.canHitSelf = true;
|
|
||||||
this.range = 20;
|
|
||||||
this.radius = 1;
|
|
||||||
this.interval = 30;
|
|
||||||
this.cooldown = GeneralMethods.getGlobalCooldown();
|
|
||||||
this.maxRadius = getConfig().getDouble("Abilities.Earth.LavaSurge.Radius");
|
|
||||||
this.horizontalPush = getConfig().getDouble("Abilities.Earth.LavaSurge.HorizontalPush");
|
|
||||||
this.verticalPush = getConfig().getDouble("Abilities.Earth.LavaSurge.VerticalPush");
|
|
||||||
this.waveBlocks = new ConcurrentHashMap<Block, Block>();
|
|
||||||
this.frozenBlocks = new ConcurrentHashMap<Block, Block>();
|
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
|
||||||
this.range = AvatarState.getValue(this.range);
|
|
||||||
this.maxRadius = AvatarState.getValue(this.maxRadius);
|
|
||||||
this.horizontalPush = AvatarState.getValue(this.horizontalPush);
|
|
||||||
this.verticalPush = AvatarState.getValue(this.verticalPush);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.prepare()) {
|
|
||||||
final LavaSurgeWave wave = getAbility(player, LavaSurgeWave.class);
|
|
||||||
if (wave != null) {
|
|
||||||
wave.remove();
|
|
||||||
}
|
|
||||||
this.start();
|
|
||||||
this.time = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean prepare() {
|
|
||||||
this.cancelPrevious();
|
|
||||||
final Block block = BlockSource.getSourceBlock(this.player, this.range, BlockSourceType.LAVA, ClickType.SHIFT_DOWN);
|
|
||||||
|
|
||||||
if (block != null) {
|
|
||||||
this.sourceBlock = block;
|
|
||||||
this.focusBlock();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cancelPrevious() {
|
|
||||||
final LavaSurgeWave oldWave = getAbility(this.player, LavaSurgeWave.class);
|
|
||||||
if (oldWave != null) {
|
|
||||||
if (oldWave.progressing) {
|
|
||||||
oldWave.breakBlock();
|
|
||||||
} else {
|
|
||||||
oldWave.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void focusBlock() {
|
|
||||||
this.location = this.sourceBlock.getLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void moveLava() {
|
|
||||||
if (this.bPlayer.isOnCooldown(this)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.bPlayer.addCooldown(this);
|
|
||||||
if (this.sourceBlock != null) {
|
|
||||||
if (!this.sourceBlock.getWorld().equals(this.player.getWorld())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Entity target = GeneralMethods.getTargetedEntity(this.player, this.range);
|
|
||||||
if (target == null) {
|
|
||||||
this.targetDestination = this.getTargetEarthBlock((int) this.range).getLocation();
|
|
||||||
} else {
|
|
||||||
this.targetDestination = ((LivingEntity) target).getEyeLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.targetDestination.distanceSquared(this.location) <= 1) {
|
|
||||||
this.progressing = false;
|
|
||||||
this.targetDestination = null;
|
|
||||||
} else {
|
|
||||||
this.progressing = true;
|
|
||||||
this.targetDirection = this.getDirection(this.sourceBlock.getLocation(), this.targetDestination).normalize();
|
|
||||||
this.targetDestination = this.location.clone().add(this.targetDirection.clone().multiply(this.range));
|
|
||||||
|
|
||||||
if (!GeneralMethods.isAdjacentToThreeOrMoreSources(this.sourceBlock)) {
|
|
||||||
this.sourceBlock.setType(Material.AIR);
|
|
||||||
}
|
|
||||||
this.addLava(this.sourceBlock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Vector getDirection(final Location location, final Location destination) {
|
|
||||||
double x1, y1, z1;
|
|
||||||
double x0, y0, z0;
|
|
||||||
x1 = destination.getX();
|
|
||||||
y1 = destination.getY();
|
|
||||||
z1 = destination.getZ();
|
|
||||||
x0 = location.getX();
|
|
||||||
y0 = location.getY();
|
|
||||||
z0 = location.getZ();
|
|
||||||
return new Vector(x1 - x0, y1 - y0, z1 - z0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void progress() {
|
|
||||||
if (!this.bPlayer.canBendIgnoreCooldowns(this)) {
|
|
||||||
this.breakBlock();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (System.currentTimeMillis() - this.time >= this.interval) {
|
|
||||||
this.time = System.currentTimeMillis();
|
|
||||||
if (!this.progressing) {
|
|
||||||
this.sourceBlock.getWorld().playEffect(this.location, Effect.SMOKE, 4, (int) this.range);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Vector direction = this.targetDirection;
|
|
||||||
this.location = this.location.clone().add(direction);
|
|
||||||
final Block blockl = this.location.getBlock();
|
|
||||||
final ArrayList<Block> blocks = new ArrayList<Block>();
|
|
||||||
|
|
||||||
if (!GeneralMethods.isRegionProtectedFromBuild(this, this.location) && (ElementalAbility.isAir(blockl.getType()) || blockl.getType() == Material.FIRE || ElementalAbility.isPlant(blockl) || isLava(blockl))) {
|
|
||||||
for (double i = 0; i <= this.radius; i += 0.5) {
|
|
||||||
for (double angle = 0; angle < 360; angle += 10) {
|
|
||||||
final Vector vec = GeneralMethods.getOrthogonalVector(this.targetDirection, angle, i);
|
|
||||||
final Block block = this.location.clone().add(vec).getBlock();
|
|
||||||
|
|
||||||
if (!blocks.contains(block) && (ElementalAbility.isAir(block.getType()) || block.getType() == Material.FIRE) || this.isLavabendable(block)) {
|
|
||||||
blocks.add(block);
|
|
||||||
FireBlast.removeFireBlastsAroundPoint(block.getLocation(), 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Block block : this.waveBlocks.keySet()) {
|
|
||||||
if (!blocks.contains(block)) {
|
|
||||||
this.finalRemoveLava(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final Block block : blocks) {
|
|
||||||
if (!this.waveBlocks.containsKey(block)) {
|
|
||||||
this.addLava(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.waveBlocks.isEmpty()) {
|
|
||||||
this.breakBlock();
|
|
||||||
this.progressing = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, 2 * this.radius)) {
|
|
||||||
boolean knockback = false;
|
|
||||||
for (final Block block : this.waveBlocks.keySet()) {
|
|
||||||
if (entity.getLocation().distanceSquared(block.getLocation()) <= 2 * 2) {
|
|
||||||
if (entity.getEntityId() != this.player.getEntityId() || this.canHitSelf) {
|
|
||||||
knockback = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (knockback) {
|
|
||||||
final Vector dir = direction.clone();
|
|
||||||
dir.setY(dir.getY() * this.verticalPush);
|
|
||||||
entity.setVelocity(entity.getVelocity().clone().add(dir.clone().multiply(this.horizontalPush)));
|
|
||||||
entity.setFallDistance(0);
|
|
||||||
|
|
||||||
if (entity.getFireTicks() > 0) {
|
|
||||||
entity.getWorld().playEffect(entity.getLocation(), Effect.EXTINGUISH, 0);
|
|
||||||
}
|
|
||||||
entity.setFireTicks(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.progressing) {
|
|
||||||
this.breakBlock();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.location.distanceSquared(this.targetDestination) < 1) {
|
|
||||||
this.progressing = false;
|
|
||||||
this.breakBlock();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.radius < this.maxRadius) {
|
|
||||||
this.radius += .5;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void breakBlock() {
|
|
||||||
for (final Block block : this.waveBlocks.keySet()) {
|
|
||||||
this.finalRemoveLava(block);
|
|
||||||
}
|
|
||||||
this.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void finalRemoveLava(final Block block) {
|
|
||||||
if (this.waveBlocks.containsKey(block)) {
|
|
||||||
TempBlock.revertBlock(block, Material.AIR);
|
|
||||||
this.waveBlocks.remove(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addLava(final Block block) {
|
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) {
|
|
||||||
return;
|
|
||||||
} else if (!TempBlock.isTempBlock(block)) {
|
|
||||||
new TempBlock(block, Material.LAVA, GeneralMethods.getLavaData(0));
|
|
||||||
this.waveBlocks.put(block, block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isBlockInWave(final Block block) {
|
|
||||||
for (final LavaSurgeWave lavaWave : getAbilities(LavaSurgeWave.class)) {
|
|
||||||
if (block.getWorld().equals(lavaWave.location.getWorld()) && block.getLocation().distance(lavaWave.location) <= 2 * lavaWave.radius) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isBlockWave(final Block block) {
|
|
||||||
for (final LavaSurgeWave lavaWave : getAbilities(LavaSurgeWave.class)) {
|
|
||||||
if (lavaWave.waveBlocks.containsKey(block)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void launch(final Player player) {
|
|
||||||
final LavaSurgeWave lavaWave = getAbility(player, LavaSurgeWave.class);
|
|
||||||
if (lavaWave != null) {
|
|
||||||
lavaWave.moveLava();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void cleanup() {
|
|
||||||
for (final LavaSurgeWave lavaWave : getAbilities(LavaSurgeWave.class)) {
|
|
||||||
for (final Block block : lavaWave.waveBlocks.keySet()) {
|
|
||||||
block.setType(Material.AIR);
|
|
||||||
lavaWave.waveBlocks.remove(block);
|
|
||||||
}
|
|
||||||
for (final Block block : lavaWave.frozenBlocks.keySet()) {
|
|
||||||
block.setType(Material.AIR);
|
|
||||||
lavaWave.frozenBlocks.remove(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "LavaSurgeWave";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location getLocation() {
|
|
||||||
return this.location;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getCooldown() {
|
|
||||||
return this.cooldown;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSneakAbility() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHarmlessAbility() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHiddenAbility() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isProgressing() {
|
|
||||||
return this.progressing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProgressing(final boolean progressing) {
|
|
||||||
this.progressing = progressing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCanHitSelf() {
|
|
||||||
return this.canHitSelf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCanHitSelf(final boolean canHitSelf) {
|
|
||||||
this.canHitSelf = canHitSelf;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTime() {
|
|
||||||
return this.time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTime(final long time) {
|
|
||||||
this.time = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getRange() {
|
|
||||||
return this.range;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRange(final double range) {
|
|
||||||
this.range = range;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getRadius() {
|
|
||||||
return this.radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRadius(final double radius) {
|
|
||||||
this.radius = radius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getMaxRadius() {
|
|
||||||
return this.maxRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxRadius(final double maxRadius) {
|
|
||||||
this.maxRadius = maxRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getHorizontalPush() {
|
|
||||||
return this.horizontalPush;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHorizontalPush(final double horizontalPush) {
|
|
||||||
this.horizontalPush = horizontalPush;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getVerticalPush() {
|
|
||||||
return this.verticalPush;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVerticalPush(final double verticalPush) {
|
|
||||||
this.verticalPush = verticalPush;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getInterval() {
|
|
||||||
return this.interval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInterval(final double interval) {
|
|
||||||
this.interval = interval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Block getSourceBlock() {
|
|
||||||
return this.sourceBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSourceBlock(final Block sourceBlock) {
|
|
||||||
this.sourceBlock = sourceBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getTargetDestination() {
|
|
||||||
return this.targetDestination;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTargetDestination(final Location targetDestination) {
|
|
||||||
this.targetDestination = targetDestination;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector getTargetDirection() {
|
|
||||||
return this.targetDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTargetDirection(final Vector targetDirection) {
|
|
||||||
this.targetDirection = targetDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConcurrentHashMap<Block, Block> getWaveBlocks() {
|
|
||||||
return this.waveBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConcurrentHashMap<Block, Block> getFrozenBlocks() {
|
|
||||||
return this.frozenBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCooldown(final long cooldown) {
|
|
||||||
this.cooldown = cooldown;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocation(final Location location) {
|
|
||||||
this.location = location;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -12,9 +12,10 @@ import org.bukkit.inventory.ItemStack;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.MetalAbility;
|
import com.projectkorra.projectkorra.ability.MetalAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.ExtractionConfig;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public class Extraction extends MetalAbility {
|
public class Extraction extends MetalAbility<ExtractionConfig> {
|
||||||
|
|
||||||
@Attribute("DoubleChance")
|
@Attribute("DoubleChance")
|
||||||
private int doubleChance;
|
private int doubleChance;
|
||||||
|
@ -26,13 +27,13 @@ public class Extraction extends MetalAbility {
|
||||||
private long cooldown;
|
private long cooldown;
|
||||||
private Block originBlock;
|
private Block originBlock;
|
||||||
|
|
||||||
public Extraction(final Player player) {
|
public Extraction(final ExtractionConfig config, final Player player) {
|
||||||
super(player);
|
super(config, player);
|
||||||
|
|
||||||
this.doubleChance = getConfig().getInt("Abilities.Earth.Extraction.DoubleLootChance");
|
this.doubleChance = config.DoubleLootChance;
|
||||||
this.tripleChance = getConfig().getInt("Abilities.Earth.Extraction.TripleLootChance");
|
this.tripleChance = config.TripleLootChance;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.Extraction.Cooldown");
|
this.cooldown = config.Cooldown;
|
||||||
this.selectRange = getConfig().getInt("Abilities.Earth.Extraction.SelectRange");
|
this.selectRange = config.SelectRange;
|
||||||
|
|
||||||
if (!this.bPlayer.canBend(this)) {
|
if (!this.bPlayer.canBend(this)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -22,10 +22,11 @@ import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.MetalAbility;
|
import com.projectkorra.projectkorra.ability.MetalAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.MetalClipsConfig;
|
||||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||||
import com.projectkorra.projectkorra.util.TempArmor;
|
import com.projectkorra.projectkorra.util.TempArmor;
|
||||||
|
|
||||||
public class MetalClips extends MetalAbility {
|
public class MetalClips extends MetalAbility<MetalClipsConfig> {
|
||||||
|
|
||||||
private static final Map<Entity, Integer> ENTITY_CLIPS_COUNT = new ConcurrentHashMap<>();
|
private static final Map<Entity, Integer> ENTITY_CLIPS_COUNT = new ConcurrentHashMap<>();
|
||||||
private static final Map<Entity, MetalClips> TARGET_TO_ABILITY = new ConcurrentHashMap<>();
|
private static final Map<Entity, MetalClips> TARGET_TO_ABILITY = new ConcurrentHashMap<>();
|
||||||
|
@ -43,9 +44,9 @@ public class MetalClips extends MetalAbility {
|
||||||
private boolean hasSnuck;
|
private boolean hasSnuck;
|
||||||
private int metalClipsCount;
|
private int metalClipsCount;
|
||||||
private int abilityType;
|
private int abilityType;
|
||||||
private int armorTime;
|
private long armorTime;
|
||||||
@Attribute("Magnet" + Attribute.RANGE)
|
@Attribute("Magnet" + Attribute.RANGE)
|
||||||
private int magnetRange;
|
private double magnetRange;
|
||||||
private long armorStartTime;
|
private long armorStartTime;
|
||||||
@Attribute(Attribute.COOLDOWN)
|
@Attribute(Attribute.COOLDOWN)
|
||||||
private long cooldown;
|
private long cooldown;
|
||||||
|
@ -66,8 +67,8 @@ public class MetalClips extends MetalAbility {
|
||||||
private LivingEntity targetEntity;
|
private LivingEntity targetEntity;
|
||||||
private List<Item> trackedIngots;
|
private List<Item> trackedIngots;
|
||||||
|
|
||||||
public MetalClips(final Player player, final int abilityType) {
|
public MetalClips(final MetalClipsConfig config, final Player player, final int abilityType) {
|
||||||
super(player);
|
super(config, player);
|
||||||
if (hasAbility(player, MetalClips.class)) {
|
if (hasAbility(player, MetalClips.class)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -75,23 +76,23 @@ public class MetalClips extends MetalAbility {
|
||||||
this.abilityType = abilityType;
|
this.abilityType = abilityType;
|
||||||
this.canLoot = player.hasPermission("bending.ability.MetalClips.loot");
|
this.canLoot = player.hasPermission("bending.ability.MetalClips.loot");
|
||||||
this.canUse4Clips = player.hasPermission("bending.ability.MetalClips.4clips");
|
this.canUse4Clips = player.hasPermission("bending.ability.MetalClips.4clips");
|
||||||
this.armorTime = getConfig().getInt("Abilities.Earth.MetalClips.Duration");
|
this.armorTime = config.Duration;
|
||||||
this.range = getConfig().getDouble("Abilities.Earth.MetalClips.Range");
|
this.range = config.Range;
|
||||||
this.cooldown = getConfig().getLong("Abilities.Earth.MetalClips.Cooldown");
|
this.cooldown = config.Cooldown;
|
||||||
this.shootCooldown = 600;
|
this.shootCooldown = 600;
|
||||||
this.crushCooldown = getConfig().getLong("Abilities.Earth.MetalClips.Crush.Cooldown");
|
this.crushCooldown = config.CrushConfig.Cooldown;
|
||||||
this.magnetCooldown = getConfig().getLong("Abilities.Earth.MetalClips.Magnet.Cooldown");
|
this.magnetCooldown = config.MagnetConfig.Cooldown;
|
||||||
this.magnetRange = getConfig().getInt("Abilities.Earth.MetalClips.Magnet.Range");
|
this.magnetRange = config.MagnetConfig.Range;
|
||||||
this.magnetSpeed = getConfig().getDouble("Abilities.Earth.MetalClips.Magnet.Speed");
|
this.magnetSpeed = config.MagnetConfig.Speed;
|
||||||
this.crushDamage = getConfig().getDouble("Abilities.Earth.MetalClips.Crush.Damage");
|
this.crushDamage = config.CrushConfig.Damage;
|
||||||
this.damage = getConfig().getDouble("Abilities.Earth.MetalClips.Damage");
|
this.damage = config.Damage;
|
||||||
this.canThrow = (getConfig().getBoolean("Abilities.Earth.MetalClips.ThrowEnabled") && player.hasPermission("bending.ability.metalclips.throw"));
|
this.canThrow = config.ThrowEnabled && player.hasPermission("bending.ability.metalclips.throw");
|
||||||
this.trackedIngots = new ArrayList<>();
|
this.trackedIngots = new ArrayList<>();
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.MetalClips.Cooldown");
|
this.cooldown = config.AvatarState_Cooldown;
|
||||||
this.range = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.MetalClips.Range");
|
this.range = config.AvatarState_Range;
|
||||||
this.crushDamage = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.MetalClips.CrushDamage");
|
this.crushDamage = config.CrushConfig.AvatarState_Damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abilityType == 0) {
|
if (abilityType == 0) {
|
||||||
|
@ -612,11 +613,11 @@ public class MetalClips extends MetalAbility {
|
||||||
this.abilityType = abilityType;
|
this.abilityType = abilityType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getArmorTime() {
|
public long getArmorTime() {
|
||||||
return this.armorTime;
|
return this.armorTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArmorTime(final int armorTime) {
|
public void setArmorTime(final long armorTime) {
|
||||||
this.armorTime = armorTime;
|
this.armorTime = armorTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,11 +629,11 @@ public class MetalClips extends MetalAbility {
|
||||||
this.crushDamage = crushDamage;
|
this.crushDamage = crushDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMagnetRange() {
|
public double getMagnetRange() {
|
||||||
return this.magnetRange;
|
return this.magnetRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMagnetRange(final int magnetRange) {
|
public void setMagnetRange(final double magnetRange) {
|
||||||
this.magnetRange = magnetRange;
|
this.magnetRange = magnetRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,18 +15,20 @@ import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||||
import com.projectkorra.projectkorra.ability.PassiveAbility;
|
import com.projectkorra.projectkorra.ability.PassiveAbility;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.DensityShiftConfig;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.properties.GeneralPropertiesConfig;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public class DensityShift extends EarthAbility implements PassiveAbility {
|
public class DensityShift extends EarthAbility<DensityShiftConfig> implements PassiveAbility {
|
||||||
private static final Set<TempBlock> SAND_BLOCKS = new HashSet<>();
|
private static final Set<TempBlock> SAND_BLOCKS = new HashSet<>();
|
||||||
|
|
||||||
public DensityShift(final Player player) {
|
public DensityShift(final DensityShiftConfig config, final Player player) {
|
||||||
super(player);
|
super(config, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean softenLanding(final Player player) {
|
public static boolean softenLanding(final DensityShiftConfig config, final Player player) {
|
||||||
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
|
if (Commands.isToggledForAll && ConfigManager.getConfig(GeneralPropertiesConfig.class).TogglePassivesWithAllBending) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +36,7 @@ public class DensityShift extends EarthAbility implements PassiveAbility {
|
||||||
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
} else if (bPlayer.canMetalbend() && ElementalAbility.isMetalBlock(block)) {
|
} else if (bPlayer.canMetalbend() && ElementalAbility.isMetal(block)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +53,7 @@ public class DensityShift extends EarthAbility implements PassiveAbility {
|
||||||
|
|
||||||
if (!SAND_BLOCKS.contains(tb)) {
|
if (!SAND_BLOCKS.contains(tb)) {
|
||||||
SAND_BLOCKS.add(tb);
|
SAND_BLOCKS.add(tb);
|
||||||
tb.setRevertTime(getDuration());
|
tb.setRevertTime(config.Duration);
|
||||||
tb.setRevertTask(() -> SAND_BLOCKS.remove(tb));
|
tb.setRevertTask(() -> SAND_BLOCKS.remove(tb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,10 +96,6 @@ public class DensityShift extends EarthAbility implements PassiveAbility {
|
||||||
return SAND_BLOCKS;
|
return SAND_BLOCKS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getDuration() {
|
|
||||||
return ConfigManager.getConfig().getLong("Abilities.Earth.Passive.Duration");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void progress() {}
|
public void progress() {}
|
||||||
|
|
||||||
|
|
|
@ -2,34 +2,10 @@ package com.projectkorra.projectkorra.earthbending.passive;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.earthbending.lava.LavaSurgeWall;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.lava.LavaSurgeWave;
|
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public class EarthPassive {
|
public class EarthPassive {
|
||||||
public static boolean canPhysicsChange(final Block block) {
|
public static boolean canPhysicsChange(final Block block) {
|
||||||
if (LavaSurgeWall.getAffectedBlocks().containsKey(block)) {
|
return !TempBlock.isTempBlock(block);
|
||||||
return false;
|
|
||||||
} else if (LavaSurgeWall.getWallBlocks().containsKey(block)) {
|
|
||||||
return false;
|
|
||||||
} else if (LavaSurgeWave.isBlockWave(block)) {
|
|
||||||
return false;
|
|
||||||
} else if (TempBlock.isTempBlock(block)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean canFlowFromTo(final Block from, final Block to) {
|
|
||||||
if (LavaSurgeWall.getAffectedBlocks().containsKey(to) || LavaSurgeWall.getAffectedBlocks().containsKey(from)) {
|
|
||||||
return false;
|
|
||||||
} else if (LavaSurgeWall.getWallBlocks().containsKey(to) || LavaSurgeWall.getWallBlocks().containsKey(from)) {
|
|
||||||
return false;
|
|
||||||
} else if (LavaSurgeWave.isBlockWave(to) || LavaSurgeWave.isBlockWave(from)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,13 +13,14 @@ import org.bukkit.entity.Player;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.MetalAbility;
|
import com.projectkorra.projectkorra.ability.MetalAbility;
|
||||||
import com.projectkorra.projectkorra.ability.PassiveAbility;
|
import com.projectkorra.projectkorra.ability.PassiveAbility;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.FerroControlConfig;
|
||||||
|
|
||||||
public class FerroControl extends MetalAbility implements PassiveAbility {
|
public class FerroControl extends MetalAbility<FerroControlConfig> implements PassiveAbility {
|
||||||
|
|
||||||
private Block block;
|
private Block block;
|
||||||
|
|
||||||
public FerroControl(final Player player) {
|
public FerroControl(final FerroControlConfig config, final Player player) {
|
||||||
super(player);
|
super(config, player);
|
||||||
|
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.projectkorra.projectkorra.earthbending.util;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.TremorsenseConfig;
|
||||||
import com.projectkorra.projectkorra.earthbending.Shockwave;
|
import com.projectkorra.projectkorra.earthbending.Shockwave;
|
||||||
import com.projectkorra.projectkorra.earthbending.Tremorsense;
|
import com.projectkorra.projectkorra.earthbending.Tremorsense;
|
||||||
import com.projectkorra.projectkorra.util.RevertChecker;
|
import com.projectkorra.projectkorra.util.RevertChecker;
|
||||||
|
@ -18,6 +20,6 @@ public class EarthbendingManager implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
RevertChecker.revertEarthBlocks();
|
RevertChecker.revertEarthBlocks();
|
||||||
Shockwave.progressAll();
|
Shockwave.progressAll();
|
||||||
Tremorsense.manage(Bukkit.getServer());
|
Tremorsense.manage(ConfigManager.getConfig(TremorsenseConfig.class), Bukkit.getServer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.projectkorra.projectkorra.ability.util.Collision;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.IceBulletConfig;
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.IceBulletConfig;
|
||||||
import com.projectkorra.projectkorra.firebending.combo.FireComboStream;
|
import com.projectkorra.projectkorra.firebending.combo.FireComboStream;
|
||||||
import com.projectkorra.projectkorra.util.BlockSource;
|
import com.projectkorra.projectkorra.util.BlockSource;
|
||||||
|
@ -35,7 +36,7 @@ import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
import com.projectkorra.projectkorra.waterbending.util.WaterSourceGrabber;
|
import com.projectkorra.projectkorra.waterbending.util.WaterSourceGrabber;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class IceBullet extends IceAbility<IceBulletConfig> implements ComboAbility<IceBulletConfig> {
|
public class IceBullet extends IceAbility<IceBulletConfig> implements ComboAbility {
|
||||||
|
|
||||||
public static enum AbilityState {
|
public static enum AbilityState {
|
||||||
ICE_PILLAR_RISING, ICE_BULLET_FORMING
|
ICE_PILLAR_RISING, ICE_BULLET_FORMING
|
||||||
|
@ -343,8 +344,8 @@ public class IceBullet extends IceAbility<IceBulletConfig> implements ComboAbili
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object createNewComboInstance(final IceBulletConfig config, final Player player) {
|
public Object createNewComboInstance(final Player player) {
|
||||||
return new IceBullet(config, player);
|
return new IceBullet(ConfigManager.getConfig(IceBulletConfig.class), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,12 +12,13 @@ import com.projectkorra.projectkorra.ability.ComboAbility;
|
||||||
import com.projectkorra.projectkorra.ability.IceAbility;
|
import com.projectkorra.projectkorra.ability.IceAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.IceWaveConfig;
|
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.IceWaveConfig;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
|
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
|
||||||
|
|
||||||
public class IceWave extends IceAbility<IceWaveConfig> implements ComboAbility<IceWaveConfig> {
|
public class IceWave extends IceAbility<IceWaveConfig> implements ComboAbility {
|
||||||
|
|
||||||
private static final Map<Block, TempBlock> FROZEN_BLOCKS = new ConcurrentHashMap<>();
|
private static final Map<Block, TempBlock> FROZEN_BLOCKS = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@ -115,8 +116,8 @@ public class IceWave extends IceAbility<IceWaveConfig> implements ComboAbility<I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object createNewComboInstance(final IceWaveConfig config, final Player player) {
|
public Object createNewComboInstance(final Player player) {
|
||||||
return new IceWave(config, player);
|
return new IceWave(ConfigManager.getConfig(IceWaveConfig.class), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -132,7 +132,6 @@ permissions:
|
||||||
bending.earth.metalbending: true
|
bending.earth.metalbending: true
|
||||||
bending.earth.lavabending: true
|
bending.earth.lavabending: true
|
||||||
bending.earth.sandbending: true
|
bending.earth.sandbending: true
|
||||||
bending.ability.LavaSurge: true
|
|
||||||
bending.ability.LavaFlow: true
|
bending.ability.LavaFlow: true
|
||||||
bending.ability.EarthSmash: true
|
bending.ability.EarthSmash: true
|
||||||
bending.ability.SandSpout: true
|
bending.ability.SandSpout: true
|
||||||
|
|
Loading…
Reference in a new issue