From d690b369c50e55c6bb0f2e989acee21caf1f69cf Mon Sep 17 00:00:00 2001 From: Alexander Meech Date: Fri, 16 Aug 2019 11:33:48 -0400 Subject: [PATCH] Port earth abilities to new configuration system, tweak combo configuration handling, and remove LavaSurge --- .../projectkorra/projectkorra/PKListener.java | 17 +- .../projectkorra/ability/ComboAbility.java | 7 +- .../airbending/combo/AirStream.java | 7 +- .../airbending/combo/AirSweep.java | 7 +- .../airbending/combo/Twister.java | 7 +- .../chiblocking/combo/Immobilize.java | 7 +- .../configs/abilities/air/AirBlastConfig.java | 2 +- .../configs/abilities/air/AirBurstConfig.java | 2 +- .../abilities/air/AirScooterConfig.java | 2 +- .../abilities/earth/CatapultConfig.java | 28 ++ .../abilities/earth/CollapseConfig.java | 47 ++ .../abilities/earth/DensityShiftConfig.java | 23 + .../abilities/earth/EarthArmorConfig.java | 29 ++ .../abilities/earth/EarthBlastConfig.java | 34 ++ .../abilities/earth/EarthDomeConfig.java | 7 +- .../abilities/earth/EarthGrabConfig.java | 28 ++ .../abilities/earth/EarthPillarsConfig.java | 28 ++ .../abilities/earth/EarthSmashConfig.java | 70 +++ .../abilities/earth/EarthTunnelConfig.java | 34 ++ .../abilities/earth/ExtractionConfig.java | 26 + .../abilities/earth/FerroControlConfig.java | 21 + .../abilities/earth/LavaFlowConfig.java | 52 ++ .../abilities/earth/MetalClipsConfig.java | 51 ++ .../abilities/earth/RaiseEarthConfig.java | 48 ++ .../abilities/earth/ShockwaveConfig.java | 35 ++ .../abilities/earth/TremorsenseConfig.java | 27 + .../projectkorra/earthbending/Catapult.java | 17 +- .../projectkorra/earthbending/Collapse.java | 21 +- .../earthbending/CollapseWall.java | 19 +- .../projectkorra/earthbending/EarthArmor.java | 26 +- .../projectkorra/earthbending/EarthBlast.java | 36 +- .../projectkorra/earthbending/EarthDome.java | 21 +- .../projectkorra/earthbending/EarthGrab.java | 19 +- .../projectkorra/earthbending/EarthSmash.java | 65 +-- .../earthbending/EarthTunnel.java | 29 +- .../projectkorra/earthbending/RaiseEarth.java | 26 +- .../earthbending/RaiseEarthWall.java | 25 +- .../projectkorra/earthbending/Ripple.java | 23 +- .../projectkorra/earthbending/Shockwave.java | 29 +- .../earthbending/Tremorsense.java | 22 +- .../earthbending/combo/EarthDomeOthers.java | 13 +- .../earthbending/combo/EarthDomeSelf.java | 12 +- .../earthbending/combo/EarthPillars.java | 25 +- .../earthbending/lava/LavaFlow.java | 64 +-- .../earthbending/lava/LavaSurge.java | 471 ------------------ .../earthbending/lava/LavaSurgeWall.java | 466 ----------------- .../earthbending/lava/LavaSurgeWave.java | 441 ---------------- .../earthbending/metal/Extraction.java | 15 +- .../earthbending/metal/MetalClips.java | 45 +- .../earthbending/passive/DensityShift.java | 22 +- .../earthbending/passive/EarthPassive.java | 26 +- .../earthbending/passive/FerroControl.java | 7 +- .../util/EarthbendingManager.java | 4 +- .../waterbending/combo/IceBullet.java | 7 +- .../waterbending/combo/IceWave.java | 7 +- src/plugin.yml | 1 - 56 files changed, 925 insertions(+), 1725 deletions(-) create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/CatapultConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/CollapseConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/DensityShiftConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthArmorConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthBlastConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthGrabConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthPillarsConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthSmashConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthTunnelConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/ExtractionConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/FerroControlConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/LavaFlowConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/MetalClipsConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/RaiseEarthConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/ShockwaveConfig.java create mode 100644 src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/TremorsenseConfig.java delete mode 100644 src/com/projectkorra/projectkorra/earthbending/lava/LavaSurge.java delete mode 100644 src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWall.java delete mode 100644 src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWave.java diff --git a/src/com/projectkorra/projectkorra/PKListener.java b/src/com/projectkorra/projectkorra/PKListener.java index e20f5da2..3aaf54b2 100644 --- a/src/com/projectkorra/projectkorra/PKListener.java +++ b/src/com/projectkorra/projectkorra/PKListener.java @@ -132,7 +132,6 @@ import com.projectkorra.projectkorra.earthbending.Tremorsense; import com.projectkorra.projectkorra.earthbending.combo.EarthPillars; import com.projectkorra.projectkorra.earthbending.lava.LavaFlow; 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.MetalClips; import com.projectkorra.projectkorra.earthbending.passive.DensityShift; @@ -285,9 +284,7 @@ public class PKListener implements Listener { if (TempBlock.isTempBlock(fromblock) || TempBlock.isTempBlock(toblock)) { event.setCancelled(true); } else { - if (ElementalAbility.isLava(fromblock)) { - event.setCancelled(!EarthPassive.canFlowFromTo(fromblock, toblock)); - } else if (ElementalAbility.isWater(fromblock)) { + if (ElementalAbility.isWater(fromblock)) { event.setCancelled(WaterBubble.isAir(toblock)); if (!event.isCancelled()) { 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)) { 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) @@ -1724,11 +1714,6 @@ public class PKListener implements Listener { } else if (clips.getMetalClipsCount() == 4 && clips.isCanUse4Clips()) { 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")) { new LavaFlow(player, AbilityType.CLICK); } else if (abil.equalsIgnoreCase("EarthSmash")) { diff --git a/src/com/projectkorra/projectkorra/ability/ComboAbility.java b/src/com/projectkorra/projectkorra/ability/ComboAbility.java index adb5957d..ce2ecb71 100644 --- a/src/com/projectkorra/projectkorra/ability/ComboAbility.java +++ b/src/com/projectkorra/projectkorra/ability/ComboAbility.java @@ -7,9 +7,12 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig; -public interface ComboAbility { +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. diff --git a/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java b/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java index 49ca97f5..e0602098 100644 --- a/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java +++ b/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java @@ -15,10 +15,11 @@ import com.projectkorra.projectkorra.ability.ComboAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; 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.util.ClickType; -public class AirStream extends AirAbility implements ComboAbility { +public class AirStream extends AirAbility implements ComboAbility { @Attribute(Attribute.COOLDOWN) private long cooldown; @@ -200,8 +201,8 @@ public class AirStream extends AirAbility implements ComboAbili } @Override - public Object createNewComboInstance(final AirStreamConfig config, final Player player) { - return new AirStream(config, player); + public Object createNewComboInstance(final Player player) { + return new AirStream(ConfigManager.getConfig(AirStreamConfig.class), player); } @Override diff --git a/src/com/projectkorra/projectkorra/airbending/combo/AirSweep.java b/src/com/projectkorra/projectkorra/airbending/combo/AirSweep.java index 9cbbb099..49579227 100644 --- a/src/com/projectkorra/projectkorra/airbending/combo/AirSweep.java +++ b/src/com/projectkorra/projectkorra/airbending/combo/AirSweep.java @@ -18,12 +18,13 @@ import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; 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.firebending.combo.FireComboStream; import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.DamageHandler; -public class AirSweep extends AirAbility implements ComboAbility { +public class AirSweep extends AirAbility implements ComboAbility { private int progressCounter; @Attribute(Attribute.COOLDOWN) @@ -242,8 +243,8 @@ public class AirSweep extends AirAbility implements ComboAbility } @Override - public Object createNewComboInstance(final AirSweepConfig config, final Player player) { - return new AirSweep(config, player); + public Object createNewComboInstance(final Player player) { + return new AirSweep(ConfigManager.getConfig(AirSweepConfig.class), player); } @Override diff --git a/src/com/projectkorra/projectkorra/airbending/combo/Twister.java b/src/com/projectkorra/projectkorra/airbending/combo/Twister.java index bd77eb8b..f77302c4 100644 --- a/src/com/projectkorra/projectkorra/airbending/combo/Twister.java +++ b/src/com/projectkorra/projectkorra/airbending/combo/Twister.java @@ -14,10 +14,11 @@ import com.projectkorra.projectkorra.ability.ComboAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; 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.util.ClickType; -public class Twister extends AirAbility implements ComboAbility { +public class Twister extends AirAbility implements ComboAbility { public static enum AbilityState { TWISTER_MOVING, TWISTER_STATIONARY @@ -180,8 +181,8 @@ public class Twister extends AirAbility implements ComboAbility implements ComboAbility { +public class Immobilize extends ChiAbility implements ComboAbility { @Attribute(Attribute.DURATION) private long duration; @@ -89,8 +90,8 @@ public class Immobilize extends ChiAbility implements ComboAbi } @Override - public Object createNewComboInstance(final ImmobilizeConfig config, final Player player) { - return new Immobilize(config, player); + public Object createNewComboInstance(final Player player) { + return new Immobilize(ConfigManager.getConfig(ImmobilizeConfig.class), player); } @Override diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/air/AirBlastConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/air/AirBlastConfig.java index af53a406..f9dcf060 100644 --- a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/air/AirBlastConfig.java +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/air/AirBlastConfig.java @@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil public class AirBlastConfig extends AbilityConfig { + public final long Cooldown = 0; public final int AnimationParticleAmount = 0; public final int SelectionParticleAmount = 0; public final double PushFactor_Self = 0; @@ -12,7 +13,6 @@ public class AirBlastConfig extends AbilityConfig { public final double Range = 0; public final double SelectionRange = 0; public final double Radius = 0; - public final long Cooldown = 0; public final boolean CanFlickLevers = true; public final boolean CanOpenDoors = true; diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/air/AirBurstConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/air/AirBurstConfig.java index 7e94519c..f2600872 100644 --- a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/air/AirBurstConfig.java +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/air/AirBurstConfig.java @@ -4,11 +4,11 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil public class AirBurstConfig extends AbilityConfig { + public final long Cooldown = 0; public final long ChargeTime = 0; public final double FallHeightThreshold = 0; public final double PushFactor = 0; public final double Damage = 0; - public final long Cooldown = 0; public final double AnglePhi = 0; public final double AngleTheta = 0; public final int ChargeParticles = 0; diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/air/AirScooterConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/air/AirScooterConfig.java index d831d54a..b238e797 100644 --- a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/air/AirScooterConfig.java +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/air/AirScooterConfig.java @@ -4,11 +4,11 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil public class AirScooterConfig extends AbilityConfig { + public final long Cooldown = 0; public final double Speed = 0; public final double Interval = 0; public final double Radius = 0; public final long Duration = 0; - public final long Cooldown = 0; public final double MaxHeightFromGround = 0; public final boolean ShowSitting = true; diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/CatapultConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/CatapultConfig.java new file mode 100644 index 00000000..e141f332 --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/CatapultConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/CollapseConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/CollapseConfig.java new file mode 100644 index 00000000..8ad1862d --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/CollapseConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/DensityShiftConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/DensityShiftConfig.java new file mode 100644 index 00000000..7426ff3b --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/DensityShiftConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthArmorConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthArmorConfig.java new file mode 100644 index 00000000..31d38469 --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthArmorConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthBlastConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthBlastConfig.java new file mode 100644 index 00000000..eedf12bb --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthBlastConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthDomeConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthDomeConfig.java index 78954707..d22dab3c 100644 --- a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthDomeConfig.java +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthDomeConfig.java @@ -4,6 +4,11 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil 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() { super(true, "", ""); } @@ -15,7 +20,7 @@ public class EarthDomeConfig extends AbilityConfig { @Override public String[] getParents() { - return new String[] { "Abilities", "Earth" }; + return new String[] { "Abilities", "Earth", "Combos" }; } } \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthGrabConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthGrabConfig.java new file mode 100644 index 00000000..c8ca2bed --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthGrabConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthPillarsConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthPillarsConfig.java new file mode 100644 index 00000000..3af2e3b2 --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthPillarsConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthSmashConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthSmashConfig.java new file mode 100644 index 00000000..a5ee6ff1 --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthSmashConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthTunnelConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthTunnelConfig.java new file mode 100644 index 00000000..5a732f03 --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/EarthTunnelConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/ExtractionConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/ExtractionConfig.java new file mode 100644 index 00000000..b8949c39 --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/ExtractionConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/FerroControlConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/FerroControlConfig.java new file mode 100644 index 00000000..6322d945 --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/FerroControlConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/LavaFlowConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/LavaFlowConfig.java new file mode 100644 index 00000000..2c153d0d --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/LavaFlowConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/MetalClipsConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/MetalClipsConfig.java new file mode 100644 index 00000000..5d23c856 --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/MetalClipsConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/RaiseEarthConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/RaiseEarthConfig.java new file mode 100644 index 00000000..3410ff8d --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/RaiseEarthConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/ShockwaveConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/ShockwaveConfig.java new file mode 100644 index 00000000..4548771b --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/ShockwaveConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/TremorsenseConfig.java b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/TremorsenseConfig.java new file mode 100644 index 00000000..1949a3e3 --- /dev/null +++ b/src/com/projectkorra/projectkorra/configuration/better/configs/abilities/earth/TremorsenseConfig.java @@ -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" }; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/earthbending/Catapult.java b/src/com/projectkorra/projectkorra/earthbending/Catapult.java index 838c8abc..8f1e663b 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Catapult.java +++ b/src/com/projectkorra/projectkorra/earthbending/Catapult.java @@ -14,9 +14,10 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.attribute.Attribute; +import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.CatapultConfig; import com.projectkorra.projectkorra.util.ParticleEffect; -public class Catapult extends EarthAbility { +public class Catapult extends EarthAbility { private double stageTimeMult; @Attribute(Attribute.COOLDOWN) @@ -33,8 +34,8 @@ public class Catapult extends EarthAbility { private boolean cancelWithAngle; private BlockData bentBlockData; - public Catapult(final Player player, final boolean sneak) { - super(player); + public Catapult(final CatapultConfig config, final Player player, final boolean sneak) { + super(config, player); this.setFields(); final Block b = player.getLocation().getBlock().getRelative(BlockFace.DOWN, 1); if (!(isEarth(b) || isSand(b) || isMetal(b))) { @@ -48,7 +49,7 @@ public class Catapult extends EarthAbility { } if (this.bPlayer.isAvatarState()) { - this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.Catapult.Cooldown"); + this.cooldown = config.AvatarState_Cooldown; } this.charging = sneak; @@ -56,10 +57,10 @@ public class Catapult extends EarthAbility { } private void setFields() { - this.stageTimeMult = getConfig().getDouble("Abilities.Earth.Catapult.StageTimeMult"); - this.cooldown = getConfig().getLong("Abilities.Earth.Catapult.Cooldown"); - this.angle = Math.toRadians(getConfig().getDouble("Abilities.Earth.Catapult.Angle")); - this.cancelWithAngle = getConfig().getBoolean("Abilities.Earth.Catapult.CancelWithAngle"); + this.stageTimeMult = config.StageTimeMult; + this.cooldown = config.Cooldown; + this.angle = Math.toRadians(config.Angle); + this.cancelWithAngle = config.CancelWithAngle; this.activationHandled = false; this.stage = 1; this.stageStart = System.currentTimeMillis(); diff --git a/src/com/projectkorra/projectkorra/earthbending/Collapse.java b/src/com/projectkorra/projectkorra/earthbending/Collapse.java index c4d518dd..158f6ec3 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Collapse.java +++ b/src/com/projectkorra/projectkorra/earthbending/Collapse.java @@ -12,10 +12,11 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.ability.EarthAbility; 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.ClickType; -public class Collapse extends EarthAbility { +public class Collapse extends EarthAbility { private int distance; @Attribute(Attribute.HEIGHT) @@ -33,8 +34,8 @@ public class Collapse extends EarthAbility { private Block block; private Map affectedBlocks; - public Collapse(final Player player) { - super(player); + public Collapse(final CollapseConfig config, final Player player) { + super(config, player); this.setFields(); if (!this.bPlayer.canBend(this) || this.bPlayer.isOnCooldown("CollapsePillar")) { @@ -52,7 +53,7 @@ public class Collapse extends EarthAbility { this.loadAffectedBlocks(); 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) { this.start(); @@ -63,8 +64,8 @@ public class Collapse extends EarthAbility { } } - public Collapse(final Player player, final Location origin) { - super(player); + public Collapse(final CollapseConfig config, final Player player, final Location origin) { + super(config, player); this.setFields(); this.origin = origin; this.player = player; @@ -82,10 +83,10 @@ public class Collapse extends EarthAbility { } 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.selectRange = getConfig().getInt("Abilities.Earth.Collapse.SelectRange"); - this.speed = getConfig().getDouble("Abilities.Earth.Collapse.Speed"); - this.cooldown = getConfig().getLong("Abilities.Earth.Collapse.Column.Cooldown"); + this.height = this.bPlayer.isAvatarState() ? config.ColumnConfig.AvatarState_Height : config.ColumnConfig.Height; + this.selectRange = config.SelectRange; + this.speed = config.Speed; + this.cooldown = config.ColumnConfig.Cooldown; this.direction = new Vector(0, -1, 0); this.affectedBlocks = new ConcurrentHashMap<>(); } diff --git a/src/com/projectkorra/projectkorra/earthbending/CollapseWall.java b/src/com/projectkorra/projectkorra/earthbending/CollapseWall.java index ff316ff2..07b09b56 100644 --- a/src/com/projectkorra/projectkorra/earthbending/CollapseWall.java +++ b/src/com/projectkorra/projectkorra/earthbending/CollapseWall.java @@ -12,10 +12,11 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.EarthAbility; 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.ClickType; -public class CollapseWall extends EarthAbility { +public class CollapseWall extends EarthAbility { @Attribute(Attribute.SELECT_RANGE) private int selectRange; @@ -29,22 +30,22 @@ public class CollapseWall extends EarthAbility { private Map blocks; private Map baseBlocks; - public CollapseWall(final Player player) { - super(player); + public CollapseWall(final CollapseConfig config, final Player player) { + super(config, player); if (!this.bPlayer.canBend(this) || this.bPlayer.isOnCooldown("CollapseWall")) { return; } - this.selectRange = getConfig().getInt("Abilities.Earth.Collapse.SelectRange"); - this.height = getConfig().getInt("Abilities.Earth.Collapse.Wall.Height"); - this.radius = getConfig().getDouble("Abilities.Earth.Collapse.Radius"); - this.cooldown = getConfig().getLong("Abilities.Earth.Collapse.Wall.Cooldown"); + this.selectRange = config.SelectRange; + this.height = config.WallConfig.Height; + this.radius = config.WallConfig.Radius; + this.cooldown = config.WallConfig.Cooldown; this.blocks = new ConcurrentHashMap<>(); this.baseBlocks = new ConcurrentHashMap<>(); 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); @@ -64,7 +65,7 @@ public class CollapseWall extends EarthAbility { this.bPlayer.addCooldown("CollapseWall", this.cooldown); } for (final Block block : this.baseBlocks.keySet()) { - new Collapse(player, block.getLocation()); + new Collapse(config, player, block.getLocation()); } } diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java b/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java index 07bb6393..74f7753f 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java @@ -1,6 +1,6 @@ package com.projectkorra.projectkorra.earthbending; -import java.util.List; +import java.util.stream.Stream; import org.bukkit.Color; import org.bukkit.GameMode; @@ -23,11 +23,14 @@ import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.ElementalAbility; import com.projectkorra.projectkorra.attribute.Attribute; 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.TempArmor; import com.projectkorra.projectkorra.util.TempBlock; -public class EarthArmor extends EarthAbility { +public class EarthArmor extends EarthAbility { private boolean formed; private Material headMaterial; @@ -50,8 +53,8 @@ public class EarthArmor extends EarthAbility { private int maxGoldHearts; private TempArmor armor; - public EarthArmor(final Player player) { - super(player); + public EarthArmor(final EarthArmorConfig config, final Player player) { + super(config, player); if (hasAbility(player, EarthArmor.class) || !this.canBend()) { return; } @@ -60,14 +63,14 @@ public class EarthArmor extends EarthAbility { this.active = true; this.interval = 2000; this.goldHearts = 0; - this.cooldown = getConfig().getLong("Abilities.Earth.EarthArmor.Cooldown"); - this.maxDuration = getConfig().getLong("Abilities.Earth.EarthArmor.MaxDuration"); - this.selectRange = getConfig().getDouble("Abilities.Earth.EarthArmor.SelectRange"); - this.maxGoldHearts = getConfig().getInt("Abilities.Earth.EarthArmor.GoldHearts"); + this.cooldown = config.Cooldown; + this.maxDuration = config.MaxDuration; + this.selectRange = config.SelectRange; + this.maxGoldHearts = config.GoldHearts; if (this.bPlayer.isAvatarState()) { - this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthArmor.Cooldown"); - this.maxGoldHearts = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.EarthArmor.GoldHearts"); + this.cooldown = config.AvatarState_Cooldown; + this.maxGoldHearts = config.AvatarState_GoldHearts; } this.headBlock = this.getTargetEarthBlock((int) this.selectRange); @@ -469,7 +472,6 @@ public class EarthArmor extends EarthAbility { private boolean canBend() { - final List disabledWorlds = getConfig().getStringList("Properties.DisabledWorlds"); final Location playerLoc = this.player.getLocation(); if (!this.player.isOnline() || this.player.isDead()) { @@ -481,7 +483,7 @@ public class EarthArmor extends EarthAbility { return false; } else if (this.getPlayer() != null && this.getLocation() != null && !this.getLocation().getWorld().equals(this.player.getWorld())) { 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; } else if (Commands.isToggledForAll || !this.bPlayer.isToggled() || !this.bPlayer.isElementToggled(this.getElement())) { return false; diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java b/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java index b00cf9ad..376d7632 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java @@ -16,13 +16,14 @@ import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.util.Collision; 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.util.BlockSource; import com.projectkorra.projectkorra.util.ClickType; import com.projectkorra.projectkorra.util.DamageHandler; import com.projectkorra.projectkorra.util.TempBlock; -public class EarthBlast extends EarthAbility { +public class EarthBlast extends EarthAbility { private boolean isProgressing; private boolean isAtDestination; private boolean isSettingUp; @@ -50,28 +51,27 @@ public class EarthBlast extends EarthAbility { private Location firstDestination; private Block sourceBlock; - public EarthBlast(final Player player) { - super(player); + public EarthBlast(final EarthBlastConfig config, final Player player) { + super(config, player); this.isProgressing = false; this.isAtDestination = false; this.isSettingUp = true; - this.deflectRange = getConfig().getDouble("Abilities.Earth.EarthBlast.DeflectRange"); - this.collisionRadius = getConfig().getDouble("Abilities.Earth.EarthBlast.CollisionRadius"); - this.cooldown = getConfig().getLong("Abilities.Earth.EarthBlast.Cooldown"); - this.canHitSelf = getConfig().getBoolean("Abilities.Earth.EarthBlast.CanHitSelf"); - this.range = getConfig().getDouble("Abilities.Earth.EarthBlast.Range"); - this.damage = getConfig().getDouble("Abilities.Earth.EarthBlast.Damage"); - this.speed = getConfig().getDouble("Abilities.Earth.EarthBlast.Speed"); - this.pushFactor = getConfig().getDouble("Abilities.Earth.EarthBlast.Push"); - this.selectRange = getConfig().getDouble("Abilities.Earth.EarthBlast.SelectRange"); + this.deflectRange = config.DeflectRange; + this.collisionRadius = config.CollisionRadius; + this.cooldown = config.Cooldown; + this.canHitSelf = config.CanHitSelf; + this.range = config.Range; + this.damage = config.Damage; + this.speed = config.Speed; + this.pushFactor = config.PushFactor; + this.selectRange = config.SelectRange; this.time = System.currentTimeMillis(); this.interval = (long) (1000.0 / this.speed); if (this.bPlayer.isAvatarState()) { - this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthBlast.Cooldown"); - this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthBlast.Damage"); - + this.cooldown = config.AvatarState_Cooldown; + this.damage = config.AvatarState_Damage; } if (this.prepare()) { @@ -135,11 +135,7 @@ public class EarthBlast extends EarthAbility { i++; } for (int j = 0; j < this.getEarthbendableBlocks().size(); j++) { - try { - trans[i] = Material.valueOf(this.getEarthbendableBlocks().get(j)); - } catch (final IllegalArgumentException e) { - continue; - } + trans[i] = this.getEarthbendableBlocks().get(j); i++; } diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthDome.java b/src/com/projectkorra/projectkorra/earthbending/EarthDome.java index 4ad7b0a9..e2f66a32 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthDome.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthDome.java @@ -13,8 +13,11 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.EarthAbility; 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 { private Location center; @Attribute(Attribute.RADIUS) @@ -25,24 +28,24 @@ public class EarthDome extends EarthAbility { private long cooldown; private Set checked; - public EarthDome(final Player player, final Location center) { - super(player); + public EarthDome(final EarthDomeConfig config, final Player player, final Location center) { + super(config, player); if (this.bPlayer.isOnCooldown("EarthDome")) { return; } this.center = center; - this.radius = getConfig().getDouble("Abilities.Earth.EarthDome.Radius"); - this.height = getConfig().getInt("Abilities.Earth.EarthDome.Height"); - this.cooldown = getConfig().getLong("Abilities.Earth.EarthDome.Cooldown"); + this.radius = config.Radius; + this.height = config.Height; + this.cooldown = config.Cooldown; this.checked = new HashSet<>(); this.start(); } - public EarthDome(final Player player) { - this(player, player.getLocation().clone().subtract(0, 1, 0)); + public EarthDome(final EarthDomeConfig config, final Player player) { + this(config, player, player.getLocation().clone().subtract(0, 1, 0)); } private Block getAppropriateBlock(final Block block) { @@ -81,7 +84,7 @@ public class EarthDome extends EarthAbility { 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); } diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java b/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java index 4084b813..fe2f39d8 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java @@ -32,13 +32,14 @@ import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.ElementalAbility; import com.projectkorra.projectkorra.attribute.Attribute; 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.ParticleEffect; import com.projectkorra.projectkorra.util.TempArmor; import com.projectkorra.projectkorra.util.TempArmorStand; import com.projectkorra.projectkorra.util.TempBlock; -public class EarthGrab extends EarthAbility { +public class EarthGrab extends EarthAbility { private LivingEntity target; @Attribute(Attribute.COOLDOWN) @@ -66,8 +67,8 @@ public class EarthGrab extends EarthAbility { TRAP, DRAG, PROJECTING; } - public EarthGrab(final Player player, final GrabMode mode) { - super(player); + public EarthGrab(final EarthGrabConfig config, final Player player, final GrabMode mode) { + super(config, player); if (hasAbility(player, EarthGrab.class)) { getAbility(player, EarthGrab.class).remove(); @@ -88,12 +89,12 @@ public class EarthGrab extends EarthAbility { } private void setFields() { - this.range = getConfig().getDouble("Abilities.Earth.EarthGrab.Range"); - this.cooldown = getConfig().getLong("Abilities.Earth.EarthGrab.Cooldown"); - this.dragSpeed = getConfig().getDouble("Abilities.Earth.EarthGrab.DragSpeed"); - this.interval = getConfig().getLong("Abilities.Earth.EarthGrab.TrapHitInterval"); - this.trapHP = getConfig().getDouble("Abilities.Earth.EarthGrab.TrapHP"); - this.damageThreshold = getConfig().getDouble("Abilities.Earth.EarthGrab.DamageThreshold"); + this.range = config.Range; + this.cooldown = config.Cooldown; + this.dragSpeed = config.DragSpeed; + this.interval = config.TrapHitInterval; + this.trapHP = config.TrapHP; + this.damageThreshold = config.DamageThreshold; this.origin = this.player.getLocation().clone(); this.direction = this.player.getLocation().getDirection().setY(0).normalize(); this.lastHit = 0; diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java b/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java index 88cd0df3..20d8ddfd 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java @@ -20,12 +20,13 @@ import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.ElementalAbility; import com.projectkorra.projectkorra.attribute.Attribute; 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.DamageHandler; import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.TempBlock; -public class EarthSmash extends EarthAbility { +public class EarthSmash extends EarthAbility { public static enum State { START, LIFTING, LIFTED, GRABBED, SHOT, FLYING, REMOVED @@ -77,12 +78,12 @@ public class EarthSmash extends EarthAbility { private ArrayList currentBlocks; private ArrayList affectedBlocks; - public EarthSmash(final Player player, final ClickType type) { - super(player); + public EarthSmash(final EarthSmashConfig config, final Player player, final ClickType type) { + super(config, player); this.state = State.START; - this.requiredBendableBlocks = getConfig().getInt("Abilities.Earth.EarthSmash.RequiredBendableBlocks"); - this.maxBlocksToPassThrough = getConfig().getInt("Abilities.Earth.EarthSmash.MaxBlocksToPassThrough"); + this.requiredBendableBlocks = config.RequiredBendableBlocks; + this.maxBlocksToPassThrough = config.MaxBlocksToPassThrough; this.setFields(); this.affectedEntities = new ArrayList<>(); this.currentBlocks = new ArrayList<>(); @@ -142,35 +143,35 @@ public class EarthSmash extends EarthAbility { public void setFields() { final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(this.player); - this.shootAnimationInterval = getConfig().getLong("Abilities.Earth.EarthSmash.Shoot.AnimationInterval"); - this.flightAnimationInterval = getConfig().getLong("Abilities.Earth.EarthSmash.Flight.AnimationInterval"); - this.liftAnimationInterval = getConfig().getLong("Abilities.Earth.EarthSmash.LiftAnimationInterval"); - this.grabDetectionRadius = getConfig().getDouble("Abilities.Earth.EarthSmash.Grab.DetectionRadius"); - this.flightDetectionRadius = getConfig().getDouble("Abilities.Earth.EarthSmash.Flight.DetectionRadius"); - this.allowGrab = getConfig().getBoolean("Abilities.Earth.EarthSmash.Grab.Enabled"); - this.allowFlight = getConfig().getBoolean("Abilities.Earth.EarthSmash.Flight.Enabled"); - this.selectRange = getConfig().getDouble("Abilities.Earth.EarthSmash.SelectRange"); - this.grabRange = getConfig().getDouble("Abilities.Earth.EarthSmash.Grab.Range"); - this.shootRange = getConfig().getDouble("Abilities.Earth.EarthSmash.Shoot.Range"); - this.damage = getConfig().getDouble("Abilities.Earth.EarthSmash.Damage"); - this.knockback = getConfig().getDouble("Abilities.Earth.EarthSmash.Knockback"); - this.knockup = getConfig().getDouble("Abilities.Earth.EarthSmash.Knockup"); - this.flightSpeed = getConfig().getDouble("Abilities.Earth.EarthSmash.Flight.Speed"); - this.chargeTime = getConfig().getLong("Abilities.Earth.EarthSmash.ChargeTime"); - this.cooldown = getConfig().getLong("Abilities.Earth.EarthSmash.Cooldown"); - this.flightDuration = getConfig().getLong("Abilities.Earth.EarthSmash.Flight.Duration"); - this.duration = getConfig().getLong("Abilities.Earth.EarthSmash.Duration"); + this.shootAnimationInterval = config.ShootAnimationInterval; + this.flightAnimationInterval = config.FlightConfig.AnimationInterval; + this.liftAnimationInterval = config.LiftAnimationInterval; + this.grabDetectionRadius = config.GrabConfig.DetectionRadius; + this.flightDetectionRadius = config.FlightConfig.DetectionRadius; + this.allowGrab = config.GrabConfig.Enabled; + this.allowFlight = config.FlightConfig.Enabled; + this.selectRange = config.SelectRange; + this.grabRange = config.GrabConfig.Range; + this.shootRange = config.ShootRange; + this.damage = config.Damage; + this.knockback = config.Knockback; + this.knockup = config.Knockup; + this.flightSpeed = config.FlightConfig.Speed; + this.chargeTime = config.ChargeTime; + this.cooldown = config.Cooldown; + this.flightDuration = config.FlightConfig.Duration; + this.duration = config.Duration; if (bPlayer.isAvatarState()) { - this.selectRange = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.SelectRange"); - this.grabRange = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.Grab.Range"); - this.chargeTime = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthSmash.ChargeTime"); - this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthSmash.Cooldown"); - this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.Damage"); - this.knockback = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.Knockback"); - this.flightSpeed = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.Flight.Speed"); - this.flightDuration = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.EarthSmash.Flight.Duration"); - this.shootRange = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthSmash.Shoot.Range"); + this.selectRange = config.AvatarState_SelectRange; + this.grabRange = config.GrabConfig.AvatarState_Range; + this.chargeTime = config.AvatarState_ChargeTime; + this.cooldown = config.AvatarState_Cooldown; + this.damage = config.AvatarState_Damage; + this.knockback = config.AvatarState_Knockback; + this.flightSpeed = config.FlightConfig.AvatarState_Speed; + this.flightDuration = config.FlightConfig.AvatarState_Duration; + this.shootRange = config.AvatarState_ShootRange; } } diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthTunnel.java b/src/com/projectkorra/projectkorra/earthbending/EarthTunnel.java index 29319ec5..0947d250 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthTunnel.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthTunnel.java @@ -13,9 +13,10 @@ import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.ElementalAbility; import com.projectkorra.projectkorra.attribute.Attribute; +import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.EarthTunnelConfig; import com.projectkorra.projectkorra.util.TempBlock; -public class EarthTunnel extends EarthAbility { +public class EarthTunnel extends EarthAbility { private long interval; private int blocksPerInterval; @@ -40,19 +41,19 @@ public class EarthTunnel extends EarthAbility { private Location location; private Vector direction; - public EarthTunnel(final Player player) { - super(player); + public EarthTunnel(final EarthTunnelConfig config, final Player player) { + super(config, player); - this.cooldown = getConfig().getLong("Abilities.Earth.EarthTunnel.Cooldown"); - this.maxRadius = getConfig().getDouble("Abilities.Earth.EarthTunnel.MaxRadius"); - this.range = getConfig().getDouble("Abilities.Earth.EarthTunnel.Range"); - this.radius = getConfig().getDouble("Abilities.Earth.EarthTunnel.Radius"); - this.interval = getConfig().getLong("Abilities.Earth.EarthTunnel.Interval"); - this.blocksPerInterval = getConfig().getInt("Abilities.Earth.EarthTunnel.BlocksPerInterval"); - this.revert = getConfig().getBoolean("Abilities.Earth.EarthTunnel.Revert"); - this.dropLootIfNotRevert = getConfig().getBoolean("Abilities.Earth.EarthTunnel.DropLootIfNotRevert"); - this.ignoreOres = getConfig().getBoolean("Abilities.Earth.EarthTunnel.IgnoreOres"); - this.revertTime = getConfig().getLong("Properties.Earth.RevertCheckTime"); + this.cooldown = config.Cooldown; + this.maxRadius = config.MaxRadius; + this.range = config.Range; + this.radius = config.InitialRadius; + this.interval = config.Interval; + this.blocksPerInterval = config.BlocksPerInterval; + this.revert = config.Revert; + this.dropLootIfNotRevert = config.DropLootIfNotRevert; + this.ignoreOres = config.IgnoreOres; + this.revertTime = config.RevertCheckTime; this.time = System.currentTimeMillis(); @@ -73,7 +74,7 @@ public class EarthTunnel extends EarthAbility { return; } if (this.bPlayer.isAvatarState()) { - this.maxRadius = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.EarthTunnel.Radius"); + this.maxRadius = config.AvatarState_MaxRadius; } this.radiusIncrement = this.radius; diff --git a/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java b/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java index fbc88f19..102f8175 100644 --- a/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java +++ b/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java @@ -12,11 +12,11 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.ability.EarthAbility; 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.ClickType; -public class RaiseEarth extends EarthAbility { +public class RaiseEarth extends EarthAbility { private static final Map ALL_AFFECTED_BLOCKS = new ConcurrentHashMap<>(); @@ -37,8 +37,8 @@ public class RaiseEarth extends EarthAbility { private Location location; private ConcurrentHashMap affectedBlocks; - public RaiseEarth(final Player player) { - super(player); + public RaiseEarth(final RaiseEarthConfig config, final Player player) { + super(config, player); this.setFields(); if (!this.bPlayer.canBend(this) || this.bPlayer.isOnCooldown("RaiseEarthPillar")) { @@ -47,7 +47,7 @@ public class RaiseEarth extends EarthAbility { try { 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); if (this.block == null) { @@ -70,12 +70,12 @@ public class RaiseEarth extends EarthAbility { } } - public RaiseEarth(final Player player, final Location origin) { - this(player, origin, ConfigManager.getConfig().getInt("Abilities.Earth.RaiseEarth.Column.Height")); + public RaiseEarth(final RaiseEarthConfig config, final Player player, final Location origin) { + this(config, player, origin, config.ColumnConfig.Height); } - public RaiseEarth(final Player player, final Location origin, final int height) { - super(player); + public RaiseEarth(final RaiseEarthConfig config, final Player player, final Location origin, final int height) { + super(config, player); this.setFields(); this.height = height; @@ -93,10 +93,10 @@ public class RaiseEarth extends EarthAbility { } private void setFields() { - this.speed = getConfig().getDouble("Abilities.Earth.RaiseEarth.Speed"); - this.height = getConfig().getInt("Abilities.Earth.RaiseEarth.Column.Height"); - this.selectRange = getConfig().getDouble("Abilities.Earth.RaiseEarth.Column.SelectRange"); - this.cooldown = getConfig().getLong("Abilities.Earth.RaiseEarth.Column.Cooldown"); + this.speed = config.ColumnConfig.Speed; + this.height = config.ColumnConfig.Height; + this.selectRange = config.ColumnConfig.SelectRange; + this.cooldown = config.ColumnConfig.Cooldown; this.direction = new Vector(0, 1, 0); this.interval = (long) (1000.0 / this.speed); this.affectedBlocks = new ConcurrentHashMap<>(); diff --git a/src/com/projectkorra/projectkorra/earthbending/RaiseEarthWall.java b/src/com/projectkorra/projectkorra/earthbending/RaiseEarthWall.java index 72070e5e..bde88ca7 100644 --- a/src/com/projectkorra/projectkorra/earthbending/RaiseEarthWall.java +++ b/src/com/projectkorra/projectkorra/earthbending/RaiseEarthWall.java @@ -9,10 +9,11 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.ability.EarthAbility; 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.ClickType; -public class RaiseEarthWall extends EarthAbility { +public class RaiseEarthWall extends EarthAbility { @Attribute(Attribute.SELECT_RANGE) private int selectRange; @@ -24,20 +25,20 @@ public class RaiseEarthWall extends EarthAbility { private long cooldown; private Location location; - public RaiseEarthWall(final Player player) { - super(player); - this.selectRange = getConfig().getInt("Abilities.Earth.RaiseEarth.Wall.SelectRange"); - this.height = getConfig().getInt("Abilities.Earth.RaiseEarth.Wall.Height"); - this.width = getConfig().getInt("Abilities.Earth.RaiseEarth.Wall.Width"); - this.cooldown = getConfig().getLong("Abilities.Earth.RaiseEarth.Wall.Cooldown"); + public RaiseEarthWall(final RaiseEarthConfig config, final Player player) { + super(config, player); + this.selectRange = config.WallConfig.SelectRange; + this.height = config.WallConfig.Height; + this.width = config.WallConfig.Width; + this.cooldown = config.WallConfig.Cooldown; if (!this.bPlayer.canBend(this) || this.bPlayer.isOnCooldown("RaiseEarthWall")) { return; } if (this.bPlayer.isAvatarState()) { - this.height = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.RaiseEarth.Wall.Height"); - this.width = getConfig().getInt("Abilities.Avatar.AvatarState.Earth.RaiseEarth.Wall.Width"); + this.height = config.WallConfig.AvatarState_Height; + this.width = config.WallConfig.AvatarState_Width; } this.start(); @@ -105,7 +106,7 @@ public class RaiseEarthWall extends EarthAbility { block = block.getRelative(BlockFace.DOWN); if (this.isEarthbendable(block)) { shouldAddCooldown = true; - new RaiseEarth(this.player, block.getLocation(), this.height); + new RaiseEarth(config, this.player, block.getLocation(), this.height); } else if (!this.isTransparent(block)) { break; } @@ -115,14 +116,14 @@ public class RaiseEarthWall extends EarthAbility { block = block.getRelative(BlockFace.UP); if (this.isTransparent(block)) { 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)) { break; } } } else if (this.isEarthbendable(block)) { shouldAddCooldown = true; - new RaiseEarth(this.player, block.getLocation(), this.height); + new RaiseEarth(config, this.player, block.getLocation(), this.height); } } diff --git a/src/com/projectkorra/projectkorra/earthbending/Ripple.java b/src/com/projectkorra/projectkorra/earthbending/Ripple.java index 25fc4bb2..236bd1e2 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Ripple.java +++ b/src/com/projectkorra/projectkorra/earthbending/Ripple.java @@ -19,9 +19,10 @@ import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.command.Commands; +import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.ShockwaveConfig; import com.projectkorra.projectkorra.util.DamageHandler; -public class Ripple extends EarthAbility { +public class Ripple extends EarthAbility { private static final Map BLOCKS = new ConcurrentHashMap(); @@ -43,13 +44,13 @@ public class Ripple extends EarthAbility { private ArrayList locations = new ArrayList(); private ArrayList entities = new ArrayList(); - public Ripple(final Player player, final Vector direction) { - super(player); + public Ripple(final ShockwaveConfig config, final Player player, final Vector direction) { + super(config, player); this.initialize(player, this.getInitialLocation(player, direction), direction); } - public Ripple(final Player player, final Location origin, final Vector direction) { - super(player); + public Ripple(final ShockwaveConfig config, final Player player, final Location origin, final Vector direction) { + super(config, player); this.initialize(player, origin, direction); } @@ -58,9 +59,9 @@ public class Ripple extends EarthAbility { return; } - this.range = getConfig().getDouble("Abilities.Earth.Shockwave.Range"); - this.damage = getConfig().getDouble("Abilities.Earth.Shockwave.Damage"); - this.knockback = getConfig().getDouble("Abilities.Earth.Shockwave.Knockback"); + this.range = config.Range; + this.damage = config.Damage; + this.knockback = config.Knockback; this.direction = direction.clone().normalize(); this.origin = origin.clone(); this.location = origin.clone(); @@ -68,9 +69,9 @@ public class Ripple extends EarthAbility { this.entities = new ArrayList<>(); if (this.bPlayer.isAvatarState()) { - this.range = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.Shockwave.Range"); - this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.Shockwave.Damage"); - this.knockback = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.Shockwave.Knockback"); + this.range = config.AvatarState_Range; + this.damage = config.AvatarState_Damage; + this.knockback = config.AvatarState_Knockback; } this.initializeLocations(); diff --git a/src/com/projectkorra/projectkorra/earthbending/Shockwave.java b/src/com/projectkorra/projectkorra/earthbending/Shockwave.java index 56f1402d..21619f83 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Shockwave.java +++ b/src/com/projectkorra/projectkorra/earthbending/Shockwave.java @@ -6,9 +6,10 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.attribute.Attribute; +import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.ShockwaveConfig; import com.projectkorra.projectkorra.util.ParticleEffect; -public class Shockwave extends EarthAbility { +public class Shockwave extends EarthAbility { private boolean charged; @Attribute(Attribute.CHARGE_DURATION) @@ -20,19 +21,19 @@ public class Shockwave extends EarthAbility { @Attribute(Attribute.RANGE) private double range; - public Shockwave(final Player player, final boolean fall) { - super(player); + public Shockwave(final ShockwaveConfig config, final Player player, final boolean fall) { + super(config, player); - this.angle = Math.toRadians(getConfig().getDouble("Abilities.Earth.Shockwave.Angle")); - this.cooldown = getConfig().getLong("Abilities.Earth.Shockwave.Cooldown"); - this.chargeTime = getConfig().getLong("Abilities.Earth.Shockwave.ChargeTime"); - this.threshold = getConfig().getDouble("Abilities.Earth.Shockwave.FallThreshold"); - this.range = getConfig().getDouble("Abilities.Earth.Shockwave.Range"); + this.angle = Math.toRadians(config.Angle); + this.cooldown = config.Cooldown; + this.chargeTime = config.ChargeTime; + this.threshold = config.FallThreshold; + this.range = config.Range; if (this.bPlayer.isAvatarState()) { - this.range = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.Shockwave.Range"); - this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.Shockwave.Cooldown"); - this.chargeTime = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.Shockwave.ChargeTime"); + this.range = config.AvatarState_Range; + this.cooldown = config.AvatarState_Cooldown; + this.chargeTime = config.AvatarState_ChargeTime; } 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) { final double rtheta = Math.toRadians(theta); 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); } - public static void coneShockwave(final Player player) { + public static void coneShockwave(final ShockwaveConfig config, final Player player) { final Shockwave shockWave = getAbility(player, Shockwave.class); if (shockWave != null) { if (shockWave.charged) { @@ -111,7 +112,7 @@ public class Shockwave extends EarthAbility { final double rtheta = Math.toRadians(theta); final Vector vector = new Vector(Math.cos(rtheta), 0, Math.sin(rtheta)); if (vector.angle(player.getEyeLocation().getDirection()) < shockWave.angle) { - new Ripple(player, vector.normalize()); + new Ripple(config, player, vector.normalize()); } } shockWave.bPlayer.addCooldown(shockWave); diff --git a/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java b/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java index 5865ea91..0c125f37 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java +++ b/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java @@ -16,8 +16,10 @@ import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.ElementalAbility; 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 { @Deprecated private static final Map BLOCKS = new ConcurrentHashMap(); @@ -33,8 +35,8 @@ public class Tremorsense extends EarthAbility { @Attribute(Attribute.RANGE) private int stickyRange; - public Tremorsense(final Player player, final boolean clicked) { - super(player); + public Tremorsense(final TremorsenseConfig config, final Player player, final boolean clicked) { + super(config, player); if (!this.bPlayer.canBendIgnoreBinds(this)) { return; @@ -53,11 +55,11 @@ public class Tremorsense extends EarthAbility { } private void setFields() { - this.maxDepth = getConfig().getInt("Abilities.Earth.Tremorsense.MaxDepth"); - this.radius = getConfig().getInt("Abilities.Earth.Tremorsense.Radius"); - this.lightThreshold = (byte) getConfig().getInt("Abilities.Earth.Tremorsense.LightThreshold"); - this.cooldown = getConfig().getLong("Abilities.Earth.Tremorsense.Cooldown"); - this.stickyRange = getConfig().getInt("Abilities.Earth.Tremorsense.StickyRange"); + this.maxDepth = config.MaxDepth; + this.radius = config.Radius; + this.lightThreshold = config.LightThreshold; + this.cooldown = config.Cooldown; + this.stickyRange = config.StickyRange; } 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()) { if (canTremorSense(player) && !hasAbility(player, Tremorsense.class)) { - new Tremorsense(player, false); + new Tremorsense(config, player, false); } } } diff --git a/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeOthers.java b/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeOthers.java index 295fde3c..a99a4dea 100644 --- a/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeOthers.java +++ b/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeOthers.java @@ -11,10 +11,11 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.EarthAbility; 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.util.ParticleEffect; -public class EarthDomeOthers extends EarthAbility { +public class EarthDomeOthers extends EarthAbility { private Vector direction; private double range; @@ -22,8 +23,8 @@ public class EarthDomeOthers extends EarthAbility { private double maxRange; private Location loc; - public EarthDomeOthers(final Player player) { - super(player); + public EarthDomeOthers(final EarthDomeConfig config, final Player player) { + super(config, player); if (this.bPlayer.isOnCooldown("EarthDome")) { return; @@ -38,7 +39,7 @@ public class EarthDomeOthers extends EarthAbility { } this.range = 0; this.direction = this.loc.getDirection().setY(0); - this.maxRange = getConfig().getDouble("Abilities.Earth.EarthDome.Range"); + this.maxRange = config.Range; this.start(); } @@ -85,7 +86,7 @@ public class EarthDomeOthers extends EarthAbility { 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); return; } @@ -94,7 +95,7 @@ public class EarthDomeOthers extends EarthAbility { public void remove(final boolean cooldown) { super.remove(); if (cooldown) { - this.bPlayer.addCooldown("EarthDome", getConfig().getLong("Abilities.Earth.EarthDome.Cooldown")); + this.bPlayer.addCooldown("EarthDome", config.Cooldown); } } diff --git a/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeSelf.java b/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeSelf.java index 04fd92d2..f7eef61d 100644 --- a/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeSelf.java +++ b/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeSelf.java @@ -8,15 +8,17 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.ability.ComboAbility; import com.projectkorra.projectkorra.ability.EarthAbility; 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.util.ClickType; -public class EarthDomeSelf extends EarthAbility implements ComboAbility { +public class EarthDomeSelf extends EarthAbility implements ComboAbility { - public EarthDomeSelf(final Player player) { - super(player); + public EarthDomeSelf(final EarthDomeConfig config, final Player player) { + super(config, player); - new EarthDome(player); + new EarthDome(config, player); } @Override @@ -49,7 +51,7 @@ public class EarthDomeSelf extends EarthAbility implements ComboAbility { @Override public Object createNewComboInstance(final Player player) { - return new EarthDomeSelf(player); + return new EarthDomeSelf(ConfigManager.getConfig(EarthDomeConfig.class), player); } @Override diff --git a/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java b/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java index 611c63f4..89944bde 100644 --- a/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java +++ b/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java @@ -17,12 +17,15 @@ import com.projectkorra.projectkorra.ability.ComboAbility; import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; 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.util.ClickType; import com.projectkorra.projectkorra.util.DamageHandler; import com.projectkorra.projectkorra.util.ParticleEffect; -public class EarthPillars extends EarthAbility implements ComboAbility { +public class EarthPillars extends EarthAbility implements ComboAbility { @Attribute(Attribute.RADIUS) private double radius; @@ -35,8 +38,8 @@ public class EarthPillars extends EarthAbility implements ComboAbility { private boolean firstTime; private Map entities; - public EarthPillars(final Player player, final boolean fall) { - super(player); + public EarthPillars(final EarthPillarsConfig config, final Player player, final boolean fall) { + super(config, player); this.setFields(fall); 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) { - this.radius = getConfig().getDouble("Abilities.Earth.EarthPillars.Radius"); - this.damage = getConfig().getDouble("Abilities.Earth.EarthPillars.Damage.Value"); - this.knockup = getConfig().getDouble("Abilities.Earth.EarthPillars.Knockup"); - this.damaging = getConfig().getBoolean("Abilities.Earth.EarthPillars.Damage.Enabled"); + this.radius = config.Radius; + this.damage = config.Damage; + this.knockup = config.Knockup; + this.damaging = config.DealsDamage; this.entities = new HashMap<>(); if (fall) { - this.fallThreshold = getConfig().getDouble("Abilities.Earth.EarthPillars.FallThreshold"); + this.fallThreshold = config.FallHeightThreshold; this.damaging = true; this.damage *= this.knockup; this.radius = this.fallThreshold; @@ -71,7 +74,7 @@ public class EarthPillars extends EarthAbility implements ComboAbility { } 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); } @@ -134,7 +137,7 @@ public class EarthPillars extends EarthAbility implements ComboAbility { @Override public long getCooldown() { - return getConfig().getLong("Abilities.Earth.EarthPillars.Cooldown"); + return config.Cooldown; } @Override @@ -149,7 +152,7 @@ public class EarthPillars extends EarthAbility implements ComboAbility { @Override public Object createNewComboInstance(final Player player) { - return new EarthPillars(player, false); + return new EarthPillars(ConfigManager.getConfig(EarthPillarsConfig.class), player, false); } @Override diff --git a/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java b/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java index b41bf2ad..620a2e48 100644 --- a/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java +++ b/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java @@ -20,13 +20,15 @@ import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.LavaAbility; 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.ClickType; import com.projectkorra.projectkorra.util.Information; import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.TempBlock; -public class LavaFlow extends LavaAbility { +@SuppressWarnings("deprecation") +public class LavaFlow extends LavaAbility { public static enum AbilityType { SHIFT, CLICK @@ -89,8 +91,8 @@ public class LavaFlow extends LavaAbility { * @param player the player that bended the ability * @param type either shift or sneak */ - public LavaFlow(final Player player, final AbilityType type) { - super(player); + public LavaFlow(final LavaFlowConfig config, final Player player, final AbilityType type) { + super(config, player); if (!this.bPlayer.canLavabend()) { return; } @@ -106,37 +108,37 @@ public class LavaFlow extends LavaAbility { this.clickIsFinished = false; this.affectedBlocks = new ArrayList(); this.tasks = new ArrayList(); - this.revertMaterial = Material.getMaterial(getConfig().getString("Abilities.Earth.LavaFlow.RevertMaterial")); + this.revertMaterial = config.RevertMaterial; - this.shiftCooldown = getConfig().getLong("Abilities.Earth.LavaFlow.ShiftCooldown"); - this.shiftPlatformRadius = getConfig().getDouble("Abilities.Earth.LavaFlow.ShiftPlatformRadius"); - this.shiftMaxRadius = getConfig().getDouble("Abilities.Earth.LavaFlow.ShiftRadius"); - this.shiftFlowSpeed = getConfig().getDouble("Abilities.Earth.LavaFlow.ShiftFlowSpeed"); - this.shiftRemoveSpeed = getConfig().getDouble("Abilities.Earth.LavaFlow.ShiftRemoveSpeed"); - this.shiftRemoveDelay = getConfig().getLong("Abilities.Earth.LavaFlow.ShiftCleanupDelay"); - this.particleDensity = getConfig().getDouble("Abilities.Earth.LavaFlow.ParticleDensity"); - this.clickRange = getConfig().getDouble("Abilities.Earth.LavaFlow.ClickRange"); - this.clickLavaRadius = getConfig().getDouble("Abilities.Earth.LavaFlow.ClickRadius"); - this.clickLandRadius = getConfig().getDouble("Abilities.Earth.LavaFlow.ClickRadius"); - this.clickLavaDelay = getConfig().getLong("Abilities.Earth.LavaFlow.ClickLavaStartDelay"); - this.clickLandDelay = getConfig().getLong("Abilities.Earth.LavaFlow.ClickLandStartDelay"); - this.clickLavaCooldown = getConfig().getLong("Abilities.Earth.LavaFlow.ClickLavaCooldown"); - this.clickLandCooldown = getConfig().getLong("Abilities.Earth.LavaFlow.ClickLandCooldown"); - this.clickLavaCleanupDelay = getConfig().getLong("Abilities.Earth.LavaFlow.ClickLavaCleanupDelay"); - this.clickLandCleanupDelay = getConfig().getLong("Abilities.Earth.LavaFlow.ClickLandCleanupDelay"); - this.lavaCreateSpeed = getConfig().getDouble("Abilities.Earth.LavaFlow.ClickLavaCreateSpeed"); - this.landCreateSpeed = getConfig().getDouble("Abilities.Earth.LavaFlow.ClickLandCreateSpeed"); - this.upwardFlow = getConfig().getInt("Abilities.Earth.LavaFlow.UpwardFlow"); - this.downwardFlow = getConfig().getInt("Abilities.Earth.LavaFlow.DownwardFlow"); - this.allowNaturalFlow = getConfig().getBoolean("Abilities.Earth.LavaFlow.AllowNaturalFlow"); + this.shiftCooldown = config.ShiftCooldown; + this.shiftPlatformRadius = config.ShiftPlatformRadius; + this.shiftMaxRadius = config.ShiftRadius; + this.shiftFlowSpeed = config.ShiftFlowSpeed; + this.shiftRemoveSpeed = config.ShiftRemoveSpeed; + this.shiftRemoveDelay = config.ShiftCleanupDelay; + this.particleDensity = config.ParticleDensity; + this.clickRange = config.ClickRange; + this.clickLavaRadius = config.ClickRadius; + this.clickLandRadius = config.ClickRadius; + this.clickLavaDelay = config.ClickLavaStartDelay; + this.clickLandDelay = config.ClickLandStartDelay; + this.clickLavaCooldown = config.ClickLavaCooldown; + this.clickLandCooldown = config.ClickLandCooldown; + this.clickLavaCleanupDelay = config.ClickLavaCleanupDelay; + this.clickLandCleanupDelay = config.ClickLandCleanupDelay; + this.lavaCreateSpeed = config.ClickLavaCreateSpeed; + this.landCreateSpeed = config.ClickLandCreateSpeed; + this.upwardFlow = config.UpwardFlow; + this.downwardFlow = config.DownwardFlow; + this.allowNaturalFlow = config.AllowNaturalFlow; if (this.bPlayer.isAvatarState()) { - this.shiftCooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.LavaFlow.ShiftCooldown"); - this.clickLavaCooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.LavaFlow.ClickLavaCooldown"); - this.clickLandCooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.LavaFlow.ClickLandCooldown"); - this.shiftPlatformRadius = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.LavaFlow.ShiftPlatformRadius"); - this.clickLavaRadius = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.LavaFlow.ClickRadius"); - this.shiftMaxRadius = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.LavaFlow.ShiftRadius"); + this.shiftCooldown = config.AvatarState_ShiftCooldown; + this.clickLavaCooldown = config.AvatarState_ClickLavaCooldown; + this.clickLandCooldown = config.AvatarState_ClickLandCooldown; + this.shiftPlatformRadius = config.AvatarState_ShiftPlatformRadius; + this.clickLavaRadius = config.AvatarState_ClickRadius; + this.shiftMaxRadius = config.AvatarState_ShiftRadius; } if (type == AbilityType.SHIFT) { diff --git a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurge.java b/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurge.java deleted file mode 100644 index fead9aa4..00000000 --- a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurge.java +++ /dev/null @@ -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 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 fallingBlocks; - private ArrayList fracture; - private ArrayList fractureTempBlocks; - private ArrayList movingLava; - private Map lavaBlocks; - private ListIterator 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 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 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 getListIterator() { - return this.listIterator; - } - - public void setListIterator(final ListIterator listIterator) { - this.listIterator = listIterator; - } - - public ArrayList getFallingBlocks() { - return this.fallingBlocks; - } - - public ArrayList getFracture() { - return this.fracture; - } - - public ArrayList getFractureTempBlocks() { - return this.fractureTempBlocks; - } - - public ArrayList getMovingLava() { - return this.movingLava; - } - - public Map getLavaBlocks() { - return this.lavaBlocks; - } - - public void setCooldown(final long cooldown) { - this.cooldown = cooldown; - } - -} diff --git a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWall.java b/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWall.java deleted file mode 100644 index 360690f5..00000000 --- a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWall.java +++ /dev/null @@ -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 AFFECTED_BLOCKS = new ConcurrentHashMap(); - private static final Map WALL_BLOCKS = new ConcurrentHashMap(); - 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 blocks = new ArrayList(); - 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) 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 getAffectedBlocks() { - return AFFECTED_BLOCKS; - } - - public static Map 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; - } - -} diff --git a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWave.java b/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWave.java deleted file mode 100644 index cb3d3145..00000000 --- a/src/com/projectkorra/projectkorra/earthbending/lava/LavaSurgeWave.java +++ /dev/null @@ -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 waveBlocks; - private final ConcurrentHashMap 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(); - this.frozenBlocks = new ConcurrentHashMap(); - - 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 blocks = new ArrayList(); - - 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 getWaveBlocks() { - return this.waveBlocks; - } - - public ConcurrentHashMap getFrozenBlocks() { - return this.frozenBlocks; - } - - public void setCooldown(final long cooldown) { - this.cooldown = cooldown; - } - - public void setLocation(final Location location) { - this.location = location; - } - -} diff --git a/src/com/projectkorra/projectkorra/earthbending/metal/Extraction.java b/src/com/projectkorra/projectkorra/earthbending/metal/Extraction.java index d5ce3436..190df75b 100644 --- a/src/com/projectkorra/projectkorra/earthbending/metal/Extraction.java +++ b/src/com/projectkorra/projectkorra/earthbending/metal/Extraction.java @@ -12,9 +12,10 @@ import org.bukkit.inventory.ItemStack; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.MetalAbility; import com.projectkorra.projectkorra.attribute.Attribute; +import com.projectkorra.projectkorra.configuration.better.configs.abilities.earth.ExtractionConfig; import com.projectkorra.projectkorra.util.TempBlock; -public class Extraction extends MetalAbility { +public class Extraction extends MetalAbility { @Attribute("DoubleChance") private int doubleChance; @@ -26,13 +27,13 @@ public class Extraction extends MetalAbility { private long cooldown; private Block originBlock; - public Extraction(final Player player) { - super(player); + public Extraction(final ExtractionConfig config, final Player player) { + super(config, player); - this.doubleChance = getConfig().getInt("Abilities.Earth.Extraction.DoubleLootChance"); - this.tripleChance = getConfig().getInt("Abilities.Earth.Extraction.TripleLootChance"); - this.cooldown = getConfig().getLong("Abilities.Earth.Extraction.Cooldown"); - this.selectRange = getConfig().getInt("Abilities.Earth.Extraction.SelectRange"); + this.doubleChance = config.DoubleLootChance; + this.tripleChance = config.TripleLootChance; + this.cooldown = config.Cooldown; + this.selectRange = config.SelectRange; if (!this.bPlayer.canBend(this)) { return; diff --git a/src/com/projectkorra/projectkorra/earthbending/metal/MetalClips.java b/src/com/projectkorra/projectkorra/earthbending/metal/MetalClips.java index c3b95ca0..2f47dfc9 100644 --- a/src/com/projectkorra/projectkorra/earthbending/metal/MetalClips.java +++ b/src/com/projectkorra/projectkorra/earthbending/metal/MetalClips.java @@ -22,10 +22,11 @@ import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.MetalAbility; 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.TempArmor; -public class MetalClips extends MetalAbility { +public class MetalClips extends MetalAbility { private static final Map ENTITY_CLIPS_COUNT = new ConcurrentHashMap<>(); private static final Map TARGET_TO_ABILITY = new ConcurrentHashMap<>(); @@ -43,9 +44,9 @@ public class MetalClips extends MetalAbility { private boolean hasSnuck; private int metalClipsCount; private int abilityType; - private int armorTime; + private long armorTime; @Attribute("Magnet" + Attribute.RANGE) - private int magnetRange; + private double magnetRange; private long armorStartTime; @Attribute(Attribute.COOLDOWN) private long cooldown; @@ -66,8 +67,8 @@ public class MetalClips extends MetalAbility { private LivingEntity targetEntity; private List trackedIngots; - public MetalClips(final Player player, final int abilityType) { - super(player); + public MetalClips(final MetalClipsConfig config, final Player player, final int abilityType) { + super(config, player); if (hasAbility(player, MetalClips.class)) { return; } @@ -75,23 +76,23 @@ public class MetalClips extends MetalAbility { this.abilityType = abilityType; this.canLoot = player.hasPermission("bending.ability.MetalClips.loot"); this.canUse4Clips = player.hasPermission("bending.ability.MetalClips.4clips"); - this.armorTime = getConfig().getInt("Abilities.Earth.MetalClips.Duration"); - this.range = getConfig().getDouble("Abilities.Earth.MetalClips.Range"); - this.cooldown = getConfig().getLong("Abilities.Earth.MetalClips.Cooldown"); + this.armorTime = config.Duration; + this.range = config.Range; + this.cooldown = config.Cooldown; this.shootCooldown = 600; - this.crushCooldown = getConfig().getLong("Abilities.Earth.MetalClips.Crush.Cooldown"); - this.magnetCooldown = getConfig().getLong("Abilities.Earth.MetalClips.Magnet.Cooldown"); - this.magnetRange = getConfig().getInt("Abilities.Earth.MetalClips.Magnet.Range"); - this.magnetSpeed = getConfig().getDouble("Abilities.Earth.MetalClips.Magnet.Speed"); - this.crushDamage = getConfig().getDouble("Abilities.Earth.MetalClips.Crush.Damage"); - this.damage = getConfig().getDouble("Abilities.Earth.MetalClips.Damage"); - this.canThrow = (getConfig().getBoolean("Abilities.Earth.MetalClips.ThrowEnabled") && player.hasPermission("bending.ability.metalclips.throw")); + this.crushCooldown = config.CrushConfig.Cooldown; + this.magnetCooldown = config.MagnetConfig.Cooldown; + this.magnetRange = config.MagnetConfig.Range; + this.magnetSpeed = config.MagnetConfig.Speed; + this.crushDamage = config.CrushConfig.Damage; + this.damage = config.Damage; + this.canThrow = config.ThrowEnabled && player.hasPermission("bending.ability.metalclips.throw"); this.trackedIngots = new ArrayList<>(); if (this.bPlayer.isAvatarState()) { - this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.MetalClips.Cooldown"); - this.range = getConfig().getDouble("Abilities.Avatar.AvatarState.Earth.MetalClips.Range"); - this.crushDamage = getConfig().getLong("Abilities.Avatar.AvatarState.Earth.MetalClips.CrushDamage"); + this.cooldown = config.AvatarState_Cooldown; + this.range = config.AvatarState_Range; + this.crushDamage = config.CrushConfig.AvatarState_Damage; } if (abilityType == 0) { @@ -612,11 +613,11 @@ public class MetalClips extends MetalAbility { this.abilityType = abilityType; } - public int getArmorTime() { + public long getArmorTime() { return this.armorTime; } - public void setArmorTime(final int armorTime) { + public void setArmorTime(final long armorTime) { this.armorTime = armorTime; } @@ -628,11 +629,11 @@ public class MetalClips extends MetalAbility { this.crushDamage = crushDamage; } - public int getMagnetRange() { + public double getMagnetRange() { return this.magnetRange; } - public void setMagnetRange(final int magnetRange) { + public void setMagnetRange(final double magnetRange) { this.magnetRange = magnetRange; } diff --git a/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java b/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java index fded2585..e3e4bd0e 100644 --- a/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java +++ b/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java @@ -15,18 +15,20 @@ import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.ElementalAbility; import com.projectkorra.projectkorra.ability.PassiveAbility; 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; -public class DensityShift extends EarthAbility implements PassiveAbility { +public class DensityShift extends EarthAbility implements PassiveAbility { private static final Set SAND_BLOCKS = new HashSet<>(); - public DensityShift(final Player player) { - super(player); + public DensityShift(final DensityShiftConfig config, final Player player) { + super(config, player); } - public static boolean softenLanding(final Player player) { - if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) { + public static boolean softenLanding(final DensityShiftConfig config, final Player player) { + if (Commands.isToggledForAll && ConfigManager.getConfig(GeneralPropertiesConfig.class).TogglePassivesWithAllBending) { return false; } @@ -34,7 +36,7 @@ public class DensityShift extends EarthAbility implements PassiveAbility { final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (bPlayer == null) { return false; - } else if (bPlayer.canMetalbend() && ElementalAbility.isMetalBlock(block)) { + } else if (bPlayer.canMetalbend() && ElementalAbility.isMetal(block)) { return true; } @@ -51,7 +53,7 @@ public class DensityShift extends EarthAbility implements PassiveAbility { if (!SAND_BLOCKS.contains(tb)) { SAND_BLOCKS.add(tb); - tb.setRevertTime(getDuration()); + tb.setRevertTime(config.Duration); tb.setRevertTask(() -> SAND_BLOCKS.remove(tb)); } } @@ -94,10 +96,6 @@ public class DensityShift extends EarthAbility implements PassiveAbility { return SAND_BLOCKS; } - public static long getDuration() { - return ConfigManager.getConfig().getLong("Abilities.Earth.Passive.Duration"); - } - @Override public void progress() {} diff --git a/src/com/projectkorra/projectkorra/earthbending/passive/EarthPassive.java b/src/com/projectkorra/projectkorra/earthbending/passive/EarthPassive.java index 815d4a53..b1cbdca4 100644 --- a/src/com/projectkorra/projectkorra/earthbending/passive/EarthPassive.java +++ b/src/com/projectkorra/projectkorra/earthbending/passive/EarthPassive.java @@ -2,34 +2,10 @@ package com.projectkorra.projectkorra.earthbending.passive; 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; public class EarthPassive { public static boolean canPhysicsChange(final Block block) { - if (LavaSurgeWall.getAffectedBlocks().containsKey(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; + return !TempBlock.isTempBlock(block); } } diff --git a/src/com/projectkorra/projectkorra/earthbending/passive/FerroControl.java b/src/com/projectkorra/projectkorra/earthbending/passive/FerroControl.java index 994235ab..59aac847 100644 --- a/src/com/projectkorra/projectkorra/earthbending/passive/FerroControl.java +++ b/src/com/projectkorra/projectkorra/earthbending/passive/FerroControl.java @@ -13,13 +13,14 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.MetalAbility; 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 implements PassiveAbility { private Block block; - public FerroControl(final Player player) { - super(player); + public FerroControl(final FerroControlConfig config, final Player player) { + super(config, player); this.start(); } diff --git a/src/com/projectkorra/projectkorra/earthbending/util/EarthbendingManager.java b/src/com/projectkorra/projectkorra/earthbending/util/EarthbendingManager.java index 40ff1d12..b18a7ce7 100644 --- a/src/com/projectkorra/projectkorra/earthbending/util/EarthbendingManager.java +++ b/src/com/projectkorra/projectkorra/earthbending/util/EarthbendingManager.java @@ -3,6 +3,8 @@ package com.projectkorra.projectkorra.earthbending.util; import org.bukkit.Bukkit; 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.Tremorsense; import com.projectkorra.projectkorra.util.RevertChecker; @@ -18,6 +20,6 @@ public class EarthbendingManager implements Runnable { public void run() { RevertChecker.revertEarthBlocks(); Shockwave.progressAll(); - Tremorsense.manage(Bukkit.getServer()); + Tremorsense.manage(ConfigManager.getConfig(TremorsenseConfig.class), Bukkit.getServer()); } } diff --git a/src/com/projectkorra/projectkorra/waterbending/combo/IceBullet.java b/src/com/projectkorra/projectkorra/waterbending/combo/IceBullet.java index 67317824..425904a0 100644 --- a/src/com/projectkorra/projectkorra/waterbending/combo/IceBullet.java +++ b/src/com/projectkorra/projectkorra/waterbending/combo/IceBullet.java @@ -25,6 +25,7 @@ import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; 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.firebending.combo.FireComboStream; import com.projectkorra.projectkorra.util.BlockSource; @@ -35,7 +36,7 @@ import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.waterbending.util.WaterSourceGrabber; @SuppressWarnings("deprecation") -public class IceBullet extends IceAbility implements ComboAbility { +public class IceBullet extends IceAbility implements ComboAbility { public static enum AbilityState { ICE_PILLAR_RISING, ICE_BULLET_FORMING @@ -343,8 +344,8 @@ public class IceBullet extends IceAbility implements ComboAbili } @Override - public Object createNewComboInstance(final IceBulletConfig config, final Player player) { - return new IceBullet(config, player); + public Object createNewComboInstance(final Player player) { + return new IceBullet(ConfigManager.getConfig(IceBulletConfig.class), player); } @Override diff --git a/src/com/projectkorra/projectkorra/waterbending/combo/IceWave.java b/src/com/projectkorra/projectkorra/waterbending/combo/IceWave.java index f6fb978e..dc484c1e 100644 --- a/src/com/projectkorra/projectkorra/waterbending/combo/IceWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/combo/IceWave.java @@ -12,12 +12,13 @@ import com.projectkorra.projectkorra.ability.ComboAbility; import com.projectkorra.projectkorra.ability.IceAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; 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.util.ClickType; import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.waterbending.WaterSpoutWave; -public class IceWave extends IceAbility implements ComboAbility { +public class IceWave extends IceAbility implements ComboAbility { private static final Map FROZEN_BLOCKS = new ConcurrentHashMap<>(); @@ -115,8 +116,8 @@ public class IceWave extends IceAbility implements ComboAbility