Port water abilities to new configuration system & slightly improve the new system

This commit is contained in:
Alexander Meech 2019-08-15 10:01:22 -04:00
parent d21086a1bc
commit 185c432eca
72 changed files with 1259 additions and 521 deletions

View file

@ -1438,10 +1438,10 @@ public class GeneralMethods {
isHarmless = coreAbil.isHarmlessAbility();
}
if (ability == null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_AllowHarmlessAbilities) {
if (ability == null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.AllowHarmlessAbilities) {
return false;
}
if (isHarmless && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_AllowHarmlessAbilities) {
if (isHarmless && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.AllowHarmlessAbilities) {
return false;
}
@ -1459,7 +1459,7 @@ public class GeneralMethods {
for (final Location location : new Location[] { loc, player.getLocation() }) {
final World world = location.getWorld();
if (lwc != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectLWC) {
if (lwc != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectLWC) {
final LWCPlugin lwcp = (LWCPlugin) lwc;
final LWC lwc2 = lwcp.getLWC();
final Protection protection = lwc2.getProtectionCache().getProtection(location.getBlock());
@ -1469,7 +1469,7 @@ public class GeneralMethods {
}
}
}
if (wgp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectWorldGuard && !player.hasPermission("worldguard.region.bypass." + world.getName())) {
if (wgp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectWorldGuard && !player.hasPermission("worldguard.region.bypass." + world.getName())) {
final WorldGuard wg = WorldGuard.getInstance();
if (!player.isOnline()) {
return true;
@ -1507,7 +1507,7 @@ public class GeneralMethods {
}
}
if (facsfw != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectFactions) {
if (facsfw != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectFactions) {
final FPlayer fPlayer = FPlayers.getBySender(player);
final Faction faction = Factions.getFactionAt(location);
final Rel relation = fPlayer.getRelationTo(faction);
@ -1517,7 +1517,7 @@ public class GeneralMethods {
}
}
if (twnp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectTowny) {
if (twnp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectTowny) {
final Towny twn = (Towny) twnp;
WorldCoord worldCoord;
@ -1553,7 +1553,7 @@ public class GeneralMethods {
}
}
if (gpp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectGriefPrevention) {
if (gpp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectGriefPrevention) {
Material type = player.getWorld().getBlockAt(location).getType();
if (type == null) {
type = Material.AIR;
@ -1567,18 +1567,18 @@ public class GeneralMethods {
}
}
if (residence != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectResidence) {
if (residence != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectResidence) {
final ResidenceInterface res = Residence.getInstance().getResidenceManagerAPI();
final ClaimedResidence claim = res.getByLoc(location);
if (claim != null) {
final ResidencePermissions perms = claim.getPermissions();
if (!perms.hasApplicableFlag(player.getName(), ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_ResidenceFlag)) {
if (!perms.hasApplicableFlag(player.getName(), ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.ResidenceFlag)) {
return true;
}
}
}
if (kingdoms != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectKingdoms) {
if (kingdoms != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectKingdoms) {
final KingdomPlayer kPlayer = GameManagement.getPlayerManager().getOfflineKingdomPlayer(player).getKingdomPlayer();
if (kPlayer.getKingdom() != null) {
final SimpleChunkLocation chunkLocation = new SimpleChunkLocation(location.getChunk());
@ -1593,7 +1593,7 @@ public class GeneralMethods {
}
if (redprotect != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectRedProtect) {
if (redprotect != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectRedProtect) {
final RedProtectAPI api = RedProtect.get().getAPI();
final Region region = api.getRegion(location);
if (!(region != null && region.canBuild(player))) {
@ -1875,28 +1875,28 @@ public class GeneralMethods {
final Plugin kingdoms = pm.getPlugin("Kingdoms");
final Plugin redprotect = pm.getPlugin("RedProtect");
if (wgp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectWorldGuard) {
if (wgp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectWorldGuard) {
writeToDebug("WorldGuard v" + wgp.getDescription().getVersion());
}
if (fcp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectFactions) {
if (fcp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectFactions) {
writeToDebug("FactionsFramework v" + fcp.getDescription().getVersion());
}
if (twnp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectTowny) {
if (twnp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectTowny) {
writeToDebug("Towny v" + twnp.getDescription().getVersion());
}
if (gpp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectGriefPrevention) {
if (gpp != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectGriefPrevention) {
writeToDebug("GriefPrevention v" + gpp.getDescription().getVersion());
}
if (lwc != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectLWC) {
if (lwc != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectLWC) {
writeToDebug("LWC v" + lwc.getDescription().getVersion());
}
if (residence != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectResidence) {
if (residence != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectResidence) {
writeToDebug("Residence v" + residence.getDescription().getVersion());
}
if (kingdoms != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectKingdoms) {
if (kingdoms != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectKingdoms) {
writeToDebug("Kingdoms v" + kingdoms.getDescription().getVersion());
}
if (redprotect != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection_RespectRedProtect) {
if (redprotect != null && ConfigManager.getConfig(GeneralPropertiesConfig.class).RegionProtection.RespectRedProtect) {
writeToDebug("RedProtect v" + redprotect.getDescription().getVersion());
}

View file

@ -141,11 +141,11 @@ public class ProjectKorra extends JavaPlugin {
});
if (Bukkit.getPluginManager().getPlugin("Residence") != null) {
FlagPermissions.addFlag(GENERAL_PROPERTIES.RegionProtection_ResidenceFlag);
FlagPermissions.addFlag(GENERAL_PROPERTIES.RegionProtection.ResidenceFlag);
}
GeneralMethods.deserializeFile();
GeneralMethods.startCacheCleaner(GENERAL_PROPERTIES.RegionProtection_CacheBlockTime);
GeneralMethods.startCacheCleaner(GENERAL_PROPERTIES.RegionProtection.CacheBlockTime);
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new PlaceholderAPIHook(this).register();

View file

@ -5,16 +5,11 @@ import java.util.ArrayList;
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<C extends AbilityConfig> {
/**
* Accessor Method to get the instructions for using this combo.
*
* @return The steps for the combo.
*/
public abstract Object createNewComboInstance(Player player);
public abstract Object createNewComboInstance(C config, Player player);
/**
* Returns the list of abilities which constitute the combo.

View file

@ -19,7 +19,6 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.SourcedWaterAbilityConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.WaterPropertiesConfig;
import com.projectkorra.projectkorra.firebending.HeatControl;
import com.projectkorra.projectkorra.util.BlockSource;
@ -38,22 +37,6 @@ public abstract class WaterAbility<C extends AbilityConfig> extends ElementalAbi
super(config, player);
}
public boolean canAutoSource() {
if (config instanceof SourcedWaterAbilityConfig) {
return ((SourcedWaterAbilityConfig) config).CanAutoSource;
}
return false;
}
public boolean canDynamicSource() {
if (config instanceof SourcedWaterAbilityConfig) {
return ((SourcedWaterAbilityConfig) config).CanDynamicSource;
}
return false;
}
@Override
public Element getElement() {
return Element.WATER;

View file

@ -15,11 +15,10 @@ 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<AirStreamConfig> implements ComboAbility {
public class AirStream extends AirAbility<AirStreamConfig> implements ComboAbility<AirStreamConfig> {
@Attribute(Attribute.COOLDOWN)
private long cooldown;
@ -201,8 +200,8 @@ public class AirStream extends AirAbility<AirStreamConfig> implements ComboAbili
}
@Override
public Object createNewComboInstance(final Player player) {
return new AirStream(ConfigManager.getConfig(AirStreamConfig.class), player);
public Object createNewComboInstance(final AirStreamConfig config, final Player player) {
return new AirStream(config, player);
}
@Override

View file

@ -18,13 +18,12 @@ 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<AirSweepConfig> implements ComboAbility {
public class AirSweep extends AirAbility<AirSweepConfig> implements ComboAbility<AirSweepConfig> {
private int progressCounter;
@Attribute(Attribute.COOLDOWN)
@ -243,8 +242,8 @@ public class AirSweep extends AirAbility<AirSweepConfig> implements ComboAbility
}
@Override
public Object createNewComboInstance(final Player player) {
return new AirSweep(ConfigManager.getConfig(AirSweepConfig.class), player);
public Object createNewComboInstance(final AirSweepConfig config, final Player player) {
return new AirSweep(config, player);
}
@Override

View file

@ -14,11 +14,10 @@ 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<TwisterConfig> implements ComboAbility {
public class Twister extends AirAbility<TwisterConfig> implements ComboAbility<TwisterConfig> {
public static enum AbilityState {
TWISTER_MOVING, TWISTER_STATIONARY
@ -181,8 +180,8 @@ public class Twister extends AirAbility<TwisterConfig> implements ComboAbility {
}
@Override
public Object createNewComboInstance(final Player player) {
return new Twister(ConfigManager.getConfig(TwisterConfig.class), player);
public Object createNewComboInstance(final TwisterConfig config, final Player player) {
return new Twister(config, player);
}
@Override

View file

@ -15,12 +15,11 @@ import com.projectkorra.projectkorra.ability.CoreAbility;
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.chi.ImmobilizeConfig;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.MovementHandler;
public class Immobilize extends ChiAbility<ImmobilizeConfig> implements ComboAbility {
public class Immobilize extends ChiAbility<ImmobilizeConfig> implements ComboAbility<ImmobilizeConfig> {
@Attribute(Attribute.DURATION)
private long duration;
@ -90,8 +89,8 @@ public class Immobilize extends ChiAbility<ImmobilizeConfig> implements ComboAbi
}
@Override
public Object createNewComboInstance(final Player player) {
return new Immobilize(ConfigManager.getConfig(ImmobilizeConfig.class), player);
public Object createNewComboInstance(final ImmobilizeConfig config, final Player player) {
return new Immobilize(config, player);
}
@Override

View file

@ -50,34 +50,37 @@ public class ConfigManager {
try {
C defaultConfig = clazz.newInstance();
CONFIG_CACHE.put(clazz, defaultConfig);
File file = new File(JavaPlugin.getPlugin(ProjectKorra.class).getDataFolder(), "config");
file.mkdirs();
for (String parent : defaultConfig.getParents()) {
file = new File(file, parent);
file.mkdir();
}
file = new File(file, defaultConfig.getName() + ".json");
if (file.exists()) {
try {
C config = loadConfig(file, clazz);
CONFIG_CACHE.put(clazz, config);
return config;
} catch (IOException e) {
e.printStackTrace();
return defaultConfig;
if (defaultConfig.getName() != null && defaultConfig.getParents() != null) {
CONFIG_CACHE.put(clazz, defaultConfig);
File file = new File(JavaPlugin.getPlugin(ProjectKorra.class).getDataFolder(), "config");
file.mkdirs();
for (String parent : defaultConfig.getParents()) {
file = new File(file, parent);
file.mkdir();
}
} else {
try {
saveConfig(file, defaultConfig);
} catch (IOException e) {
e.printStackTrace();
file = new File(file, defaultConfig.getName() + ".json");
if (file.exists()) {
try {
C config = loadConfig(file, clazz);
CONFIG_CACHE.put(clazz, config);
return config;
} catch (IOException e) {
e.printStackTrace();
return defaultConfig;
}
} else {
try {
saveConfig(file, defaultConfig);
} catch (IOException e) {
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,19 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities;
public class EmptyAbilityConfig extends AbilityConfig {
public EmptyAbilityConfig() {
super(true, null, null);
}
@Override
public String getName() {
return null;
}
@Override
public String[] getParents() {
return null;
}
}

View file

@ -8,7 +8,7 @@ public class AirAgilityConfig extends AbilityConfig {
public final int SpeedPower = 0;
public AirAgilityConfig() {
super(true, "", "");
super(true, "", null);
}
@Override

View file

@ -7,7 +7,7 @@ public class AirSaturationConfig extends AbilityConfig {
public final double ExhaustionFactor = 0;
public AirSaturationConfig() {
super(true, "", "");
super(true, "", null);
}
@Override

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
public class AirShieldConfig extends AbilityConfig {
public final long Cooldown = 0;
public final double MaxRadius = 0;
public final double InitialRadius = 0;
public final long Duration = 0;
@ -11,7 +12,6 @@ public class AirShieldConfig extends AbilityConfig {
public final int Streams = 0;
public final int AnimationParticleAmount = 0;
public final boolean DynamicCooldown = true;
public final long Cooldown = 0;
public final boolean AvatarState_Toggle = true;

View file

@ -4,10 +4,10 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
public class AirSpoutConfig extends AbilityConfig {
public final long Cooldown = 0;
public final long Duration = 0;
public final long Interval = 0;
public final double Height = 0;
public final long Cooldown = 0;
public final double AvatarState_Height = 0;

View file

@ -4,9 +4,9 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
public class AirStreamConfig extends AbilityConfig {
public final long Cooldown = 0;
public final double Range = 0;
public final double Speed = 0;
public final long Cooldown = 0;
public final double EntityCarryHeight = 0;
public final long EntityCarryDuration = 0;

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
public class AirSuctionConfig extends AbilityConfig {
public final long Cooldown = 0;
public final int AnimationParticleAmount = 0;
public final int SelectionParticleAmount = 0;
public final double PushFactor = 0;
@ -11,7 +12,6 @@ public class AirSuctionConfig extends AbilityConfig {
public final double Range = 0;
public final double SelectionRange = 0;
public final double Radius = 0;
public final long Cooldown = 0;
public final double AvatarState_PushFactor = 0;

View file

@ -4,11 +4,11 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
public class AirSweepConfig extends AbilityConfig {
public final long Cooldown = 0;
public final double Damage = 0;
public final double Range = 0;
public final double Speed = 0;
public final double Knockback = 0;
public final long Cooldown = 0;
public final double AvatarState_Damage = 0;
public final double AvatarState_Range = 0;

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
public class AirSwipeConfig extends AbilityConfig {
public final long Cooldown = 0;
public final int AnimationParticleAmount = 0;
public final int Arc = 0;
public final int StepSize = 0;
@ -14,7 +15,6 @@ public class AirSwipeConfig extends AbilityConfig {
public final double Range = 0;
public final double Radius = 0;
public final double MaxChargeFactor = 0;
public final long Cooldown = 0;
public final long AvatarState_Cooldown = 0;
public final double AvatarState_Damage = 0;

View file

@ -4,8 +4,8 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
public class FlightConfig extends AbilityConfig {
public final long Duration = 0;
public final long Cooldown = 0;
public final long Duration = 0;
public final double BaseSpeed = 0;
public FlightConfig() {

View file

@ -5,7 +5,7 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
public class GracefulDescentConfig extends AbilityConfig {
public GracefulDescentConfig() {
super(true, "", "");
super(true, "", null);
}
@Override

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
public class SuffocateConfig extends AbilityConfig {
public final long Cooldown = 0;
public final boolean RequireConstantAim = true;
public final double ConstantAimRadius = 0;
public final boolean CanSuffocateUndead = false;
@ -12,7 +13,6 @@ public class SuffocateConfig extends AbilityConfig {
public final long ChargeTime = 0;
public final double Range = 0;
public final double AnimationRadius = 0;
public final long Cooldown = 0;
public final double Damage = 0;
public final double DamageInitialDelay = 0;
public final double DamageInterval = 0;

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
public class TornadoConfig extends AbilityConfig {
public final long Cooldown = 0;
public final long Duration = 0;
public final double Range = 0;
public final double Height = 0;
@ -11,7 +12,6 @@ public class TornadoConfig extends AbilityConfig {
public final double NpcPushFactor = 0;
public final double Radius = 0;
public final double Speed = 0;
public final long Cooldown = 0;
public TornadoConfig() {
super(true, "", "");

View file

@ -4,9 +4,9 @@ import com.projectkorra.projectkorra.configuration.better.configs.abilities.Abil
public class TwisterConfig extends AbilityConfig {
public final long Cooldown = 0;
public final double Range = 0;
public final double Speed = 0;
public final long Cooldown = 0;
public final double Height = 0;
public final double Radius = 0;
public final double DegreesPerParticle = 0;

View file

@ -7,7 +7,7 @@ public class AcrobaticsConfig extends AbilityConfig {
public final double FallReductionFactor = 0;
public AcrobaticsConfig() {
super(true, "", "");
super(true, "", null);
}
@Override

View file

@ -8,7 +8,7 @@ public class ChiAgilityConfig extends AbilityConfig {
public final int SpeedPower = 0;
public ChiAgilityConfig() {
super(true, "", "");
super(true, "", null);
}
@Override

View file

@ -7,7 +7,7 @@ public class ChiSaturationConfig extends AbilityConfig {
public final double ExhaustionFactor = 0;
public ChiSaturationConfig() {
super(true, "", "");
super(true, "", null);
}
@Override

View file

@ -0,0 +1,31 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class BloodbendingConfig extends AbilityConfig {
public final long Cooldown = 0;
public final long Duration = 0;
public final double Range = 0;
public final double Knockback = 0;
public final boolean CanOnlyBeUsedAtNight = true;
public final boolean CanBeUsedOnUndeadMobs = false;
public final boolean CanOnlyBeUsedDuringFullMoon = true;
public final boolean CanBloodbendOtherBloodbenders = false;
public BloodbendingConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "Bloodbending";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water" };
}
}

View file

@ -0,0 +1,25 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class FastSwimConfig extends AbilityConfig {
public final long Cooldown = 0;
public final long Duration = 0;
public final double SpeedFactor = 0;
public FastSwimConfig() {
super(true, "", null);
}
@Override
public String getName() {
return "FastSwim";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water", "Passives" };
}
}

View file

@ -0,0 +1,29 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class HealingWatersConfig extends AbilityConfig {
public final long Cooldown = 0;
public final long Duration = 0;
public final long Interval = 0;
public final long ChargeTime = 0;
public final double Range = 0;
public final int PotionPotency = 0;
public final boolean EnableParticles = true;
public HealingWatersConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "HealingWaters";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water" };
}
}

View file

@ -0,0 +1,21 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class HydroSinkConfig extends AbilityConfig {
public HydroSinkConfig() {
super(true, "", null);
}
@Override
public String getName() {
return "HydroSink";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water", "Passives" };
}
}

View file

@ -0,0 +1,33 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class IceBlastConfig extends AbilityConfig {
public final long Cooldown = 0;
public final long Interval = 0;
public final double CollisionRadius = 0;
public final double Range = 0;
public final double Damage = 0;
public final double DeflectRange = 0;
public final boolean AllowSnow = true;
public final long AvatarState_Cooldown = 0;
public final double AvatarState_Damage = 0;
public final double AvatarState_Range = 0;
public IceBlastConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "IceBlast";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water" };
}
}

View file

@ -0,0 +1,32 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class IceBulletConfig extends AbilityConfig {
public final long Cooldown = 0;
public final long ShotCooldown = 0;
public final long ShootTime = 0;
public final double Range = 0;
public final double Radius = 0;
public final double Damage = 0;
public final int MaxShots = 0;
public final double AnimationSpeed = 0;
public final long AvatarState_Cooldown = 0;
public IceBulletConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "IceBullet";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water", "Combos" };
}
}

View file

@ -0,0 +1,79 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class IceSpikeConfig extends AbilityConfig {
public final long Cooldown = 0;//
public final int Height = 0;//
public final double Damage = 0;//
public final double Range = 0;//
public final double Speed = 0;//
public final double Push = 0;//
public final long SlowCooldown = 0;
public final int SlowPower = 0;
public final int SlowDuration = 0;
public final double AvatarState_Damage = 0;
public final double AvatarState_Range = 0;
public final int AvatarState_Height = 0;
public final double AvatarState_Push = 0;
public final int AvatarState_SlowPower = 0;
public final int AvatarState_SlowDuration = 0;
public final BlastConfig BlastConfig = new BlastConfig();
public final FieldConfig FieldConfig = new FieldConfig();
public static class BlastConfig {
public final long Cooldown = 0;
public final long Interval = 0;
public final double Damage = 0;
public final double Range = 0;
public final double CollisionRadius = 0;
public final double DeflectRange = 0;
public final double ProjectileRange = 0;
public final long SlowCooldown = 0;
public final int SlowPotency = 0;
public final int SlowDuration = 0;
public final double AvatarState_Damage = 0;
public final double AvatarState_Range = 0;
public final int AvatarState_SlowPotency = 0;
public final int AvatarState_SlowDuration = 0;
}
public static class FieldConfig {
public final long Cooldown = 0;
public final double Damage = 0;
public final double Radius = 0;
public final double Knockup = 0;
public final double AvatarState_Damage = 0;
public final double AvatarState_Radius = 0;
}
public IceSpikeConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "IceSpike";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water" };
}
}

View file

@ -0,0 +1,30 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class IceWaveConfig extends AbilityConfig {
public final long Cooldown = 0;
public final double ThawRadius = 0;
public final double Damage = 0;
public final boolean RevertSphere = true;
public final long RevertSphereTime = 0;
public final double AvatarState_Damage = 0;
public IceWaveConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "IceWave";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water", "Combos" };
}
}

View file

@ -0,0 +1,37 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class OctopusFormConfig extends AbilityConfig {
public final long Cooldown = 0;
public final long Duration = 0;
public final long FormDelay = 0;
public final double SelectionRange = 0;
public final double Damage = 0;
public final double AttackRange = 0;
public final long UsageCooldown = 0;
public final double Knockback = 0;
public final double Radius = 0;
public final double AngleIncrement = 0;
public final double AvatarState_Damage = 0;
public final double AvatarState_AttackRange = 0;
public final double AvatarState_Knockback = 0;
public final double AvatarState_Radius = 0;
public OctopusFormConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "OctopusForm";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water" };
}
}

View file

@ -0,0 +1,45 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class PhaseChangeConfig extends AbilityConfig {
public final double SourceRange = 0;
public final FreezeConfig FreezeConfig = new FreezeConfig();
public final MeltConfig MeltConfig = new MeltConfig();
public static class FreezeConfig {
public final long Cooldown = 0;
public final int Depth = 0;
public final double ControlRadius = 0;
public final int Radius = 0;
}
public static class MeltConfig {
public final long Cooldown = 0;
public final double Speed = 0;
public final int Radius = 0;
public final boolean AllowFlow = true;
}
public PhaseChangeConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "PhaseChange";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water" };
}
}

View file

@ -0,0 +1,53 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class SurgeConfig extends AbilityConfig {
public final SurgeWaveConfig WaveConfig = new SurgeWaveConfig();
public final SurgeWallConfig WallConfig = new SurgeWallConfig();
public static class SurgeWaveConfig {
public final long Cooldown = 0;
public final long Interval = 0;
public final double Radius = 0;
public final double Knockback = 0;
public final double Knockup = 0;
public final double MaxFreezeRadius = 0;
public final long IceRevertTime = 0;
public final double Range = 0;
public final double SelectRange = 0;
public final double AvatarState_Radius = 0;
}
public static class SurgeWallConfig {
public final long Cooldown = 0;
public final long Interval = 0;
public final long Duration = 0;
public final double Range = 0;
public final double Radius = 0;
public final double AvatarState_Radius = 0;
}
public SurgeConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "Surge";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water" };
}
}

View file

@ -0,0 +1,56 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class TorrentConfig extends AbilityConfig {
public final long Cooldown = 0;
public final int MaxLayer = 0;
public final double Knockback = 0;
public final double Angle = 0;
public final double Radius = 0;
public final double Knockup = 0;
public final long Interval = 0;
public final double InitialDamage = 0;
public final double SuccessiveDamage = 0;
public final int MaxHits = 0;
public final double DeflectDamage = 0;
public final double Range = 0;
public final double SelectRange = 0;
public final boolean Revert = true;
public final long RevertTime = 0;
public final double AvatarState_Knockback = 0;
public final double AvatarState_InitialDamage = 0;
public final double AvatarState_SuccessiveDamage = 0;
public final int AvatarState_MaxHits = 0;
public final TorrentWaveConfig WaveConfig = new TorrentWaveConfig();
public static class TorrentWaveConfig {
public final long Cooldown = 0;
public final long Interval = 0;
public final double Height = 0;
public final double Radius = 0;
public final double Knockback = 0;
public final double GrowSpeed = 0;
}
public TorrentConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "Torrent";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water" };
}
}

View file

@ -0,0 +1,106 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class WaterArmsConfig extends AbilityConfig {
public final long Cooldown = 0;
public final int InitialLength = 0;
public final double SourceGrabRange = 0;
public final boolean AllowPlantSource = true;
public final int MaxAttacks = 0;
public final int MaxIceShots = 0;
public final int MaxAlternateUsage = 0;
public final boolean LightningVulnerability = true;
public final boolean LightningInstaKill = true;
public final double LightningDamage = 0;
public final String SneakMessage = "";
public final FreezeConfig FreezeConfig = new FreezeConfig();
public final SpearConfig SpearConfig = new SpearConfig();
public final WhipConfig WhipConfig = new WhipConfig();
public static class FreezeConfig {
public final long UsageCooldown = 0;
public final boolean UsageCooldownEnabled = true;
public final int Range = 0;
public final double Damage = 0;
}
public static class SpearConfig {
public final long UsageCooldown = 0;
public final boolean UsageCooldownEnabled = true;
public final int Length = 0;
public final double Damage = 0;
public final boolean DamageEnabled = true;
public final int RangeDay = 0;
public final int RangeNight = 0;
public final int RangeFullMoon = 0;
public final int SphereRadiusDay = 0;
public final int SphereRadiusNight = 0;
public final int SphereRadiusFullMoon = 0;
public final long DurationDay = 0;
public final long DurationNight = 0;
public final long DurationFullMoon = 0;
}
public static class WhipConfig {
public final boolean UsageCooldownEnabled = true;
public final int MaxLengthDay = 0;
public final int MaxLengthWeak = 0;
public final int MaxLengthNight = 0;
public final int MaxLengthFullMoon = 0;
public final long UsageCooldownPunch = 0;
public final int PunchLengthDay = 0;
public final int PunchLengthNight = 0;
public final int PunchLengthFullMoon = 0;
public final double PunchDamage = 0;
public final long UsageCooldownGrab = 0;
public final long GrabDuration = 0;
public final long UsageCooldownPull = 0;
public final double PullFactor = 0;
public final long UsageCooldownGrapple = 0;
public final boolean GrappleRespectRegions = true;
}
public WaterArmsConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "WaterArms";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water" };
}
}

View file

@ -0,0 +1,26 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class WaterBubbleConfig extends AbilityConfig {
public final long ClickDuration = 0;
public final double Radius = 0;
public final double Speed = 0;
public final boolean MustStartAboveWater = true;
public WaterBubbleConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "WaterBubble";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water" };
}
}

View file

@ -1,11 +1,22 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
public class WaterManipulationConfig extends SourcedWaterAbilityConfig {
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class WaterManipulationConfig extends AbilityConfig {
public final long Cooldown = 0;
public final double SelectRange = 0;
public final double CollisionRadius = 0;
public final double Range = 0;
public final double Knockback = 0;
public final double Damage = 0;
public final double Speed = 0;
public final double DeflectRange = 0;
public final double AvatarState_Damage = 0;
public WaterManipulationConfig() {
super(true, "", "", true, true);
super(true, "", "");
}
@Override

View file

@ -0,0 +1,47 @@
package com.projectkorra.projectkorra.configuration.better.configs.abilities.water;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.AbilityConfig;
public class WaterSpoutConfig extends AbilityConfig {
public final long Cooldown = 0;
public final boolean UseParticles = true;
public final boolean EnableBlockSpiral = true;
public final double Height = 0;
public final long Duration = 0;
public final long Interval = 0;
public final WaterSpoutWaveConfig WaveConfig = new WaterSpoutWaveConfig();
public static class WaterSpoutWaveConfig {
public final boolean Enabled = true;
public final long Cooldown = 0;
public final boolean AllowPlantSource = true;
public final double Radius = 0;
public final double WaveRadius = 0;
public final double AnimationSpeed = 0;
public final double SelectRange = 0;
public final double Speed = 0;
public final long ChargeTime = 0;
public final long FlightDuration = 0;
public final long AvatarState_FlightDuration = 0;
}
public WaterSpoutConfig() {
super(true, "", "");
}
@Override
public String getName() {
return "WaterSpout";
}
@Override
public String[] getParents() {
return new String[] { "Abilities", "Water" };
}
}

View file

@ -6,28 +6,13 @@ public class GeneralPropertiesConfig implements Config {
public final boolean UpdateChecker = true;
public final double RegionProtection_CacheBlockTime = 0;
public final boolean RegionProtection_RespectResidence = true;
public final String RegionProtection_ResidenceFlag = "";
public final boolean RegionProtection_AllowHarmlessAbilities = true;
public final boolean RegionProtection_RespectWorldGuard = true;
public final boolean RegionProtection_RespectFactions = true;
public final boolean RegionProtection_RespectTowny = true;
public final boolean RegionProtection_RespectGriefPrevention = true;
public final boolean RegionProtection_RespectLWC = true;
public final boolean RegionProtection_RespectKingdoms = true;
public final boolean RegionProtection_RespectRedProtect = true;
public final RegionProtectionConfig RegionProtection = new RegionProtectionConfig();
public final boolean Statistics = true;
public final boolean DatabaseCooldowns = true;
public final boolean UseMySQL = false;
public final String MySQL_Host = "";
public final int MySQL_Port = 3306;
public final String MySQL_User = "";
public final String MySQL_Password = "";
public final String MySQL_Database = "";
public final MySQLConfig MySQL = new MySQLConfig();
public final boolean BendingPreview = true;
@ -51,6 +36,43 @@ public class GeneralPropertiesConfig implements Config {
public final String[] DisabledWorlds = {};
public static final class RegionProtectionConfig {
public final double CacheBlockTime = 0;
public final boolean RespectResidence = true;
public final String ResidenceFlag = "";
public final boolean AllowHarmlessAbilities = true;
public final boolean RespectWorldGuard = true;
public final boolean RespectFactions = true;
public final boolean RespectTowny = true;
public final boolean RespectGriefPrevention = true;
public final boolean RespectLWC = true;
public final boolean RespectKingdoms = true;
public final boolean RespectRedProtect = true;
}
public static final class MySQLConfig {
public final boolean Enabled = false;
public final String Host = "";
public final int Port = 3306;
public final String Username = "";
public final String Password = "";
public final String Database = "";
}
@Override
public String getName() {
return "General";

View file

@ -18,6 +18,8 @@ public class WaterPropertiesConfig implements Config {
public final double MaxSelectRange = 0;
public final long PlantRegrowTime = 0;
public final boolean PlaySound = true;
public final Sound SoundType = Sound.BLOCK_WATER_AMBIENT;
public final float SoundVolume = 0;
@ -25,6 +27,9 @@ public class WaterPropertiesConfig implements Config {
public final Material[] IceBlocks = {};
public final boolean FreezePlayerHead = true;
public final boolean FreezePlayerFeet = true;
public final Sound IceSoundType = Sound.ITEM_FLINTANDSTEEL_USE;
public final float IceSoundVolume = 0;
public final float IceSoundPitch = 0;

View file

@ -21,12 +21,12 @@ public class DBConnection {
public static void init() {
GeneralPropertiesConfig config = ConfigManager.getConfig(GeneralPropertiesConfig.class);
DBConnection.host = config.MySQL_Host;
DBConnection.port = config.MySQL_Port;
DBConnection.pass = config.MySQL_Password;
DBConnection.db = config.MySQL_Database;
DBConnection.user = config.MySQL_User;
if (config.UseMySQL) {
DBConnection.host = config.MySQL.Host;
DBConnection.port = config.MySQL.Port;
DBConnection.pass = config.MySQL.Password;
DBConnection.db = config.MySQL.Database;
DBConnection.user = config.MySQL.Username;
if (config.MySQL.Enabled) {
sql = new MySQL(ProjectKorra.log, "Establishing MySQL Connection...", host, port, user, pass, db);
if (((MySQL) sql).open() == null) {
ProjectKorra.log.severe("Disabling due to database error");

View file

@ -19,6 +19,9 @@ import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
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.OctopusFormConfig;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.PhaseChangeConfig;
import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
@ -29,16 +32,17 @@ import com.projectkorra.projectkorra.waterbending.ice.PhaseChange.PhaseChangeTyp
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
import com.projectkorra.projectkorra.waterbending.util.WaterReturn;
public class OctopusForm extends WaterAbility {
@SuppressWarnings("deprecation")
public class OctopusForm extends WaterAbility<OctopusFormConfig> {
private boolean sourceSelected;
private boolean settingUp;
private boolean forming;
private boolean formed;
@Attribute(Attribute.RANGE)
private int range;
private double range;
@Attribute(Attribute.DAMAGE)
private int damage;
private double damage;
private int currentAnimationStep;
private int stepCounter;
private int totalStepCount;
@ -68,8 +72,8 @@ public class OctopusForm extends WaterAbility {
private ArrayList<TempBlock> newBlocks;
private PhaseChange pc;
public OctopusForm(final Player player) {
super(player);
public OctopusForm(final OctopusFormConfig config, final Player player) {
super(config, player);
final OctopusForm oldOctopus = getAbility(player, OctopusForm.class);
if (oldOctopus != null) {
@ -95,30 +99,30 @@ public class OctopusForm extends WaterAbility {
this.currentAnimationStep = 1;
this.stepCounter = 1;
this.totalStepCount = 3;
this.range = getConfig().getInt("Abilities.Water.OctopusForm.Range");
this.damage = getConfig().getInt("Abilities.Water.OctopusForm.Damage");
this.interval = getConfig().getLong("Abilities.Water.OctopusForm.FormDelay");
this.attackRange = getConfig().getInt("Abilities.Water.OctopusForm.AttackRange");
this.usageCooldown = getConfig().getInt("Abilities.Water.OctopusForm.UsageCooldown");
this.knockback = getConfig().getDouble("Abilities.Water.OctopusForm.Knockback");
this.radius = getConfig().getDouble("Abilities.Water.OctopusForm.Radius");
this.cooldown = getConfig().getLong("Abilities.Water.OctopusForm.Cooldown");
this.duration = getConfig().getLong("Abilities.Water.OctopusForm.Duration");
this.angleIncrement = getConfig().getDouble("Abilities.Water.OctopusForm.AngleIncrement");
this.range = config.SelectionRange;
this.damage = config.Damage;
this.interval = config.FormDelay;
this.attackRange = config.AttackRange;
this.usageCooldown = config.UsageCooldown;
this.knockback = config.Knockback;
this.radius = config.Radius;
this.cooldown = config.Cooldown;
this.duration = config.Duration;
this.angleIncrement = config.AngleIncrement;
this.currentFormHeight = 0;
this.blocks = new ArrayList<TempBlock>();
this.newBlocks = new ArrayList<TempBlock>();
if (hasAbility(player, PhaseChange.class)) {
this.pc = getAbility(player, PhaseChange.class);
} else {
this.pc = new PhaseChange(player, PhaseChangeType.CUSTOM);
this.pc = new PhaseChange(ConfigManager.getConfig(PhaseChangeConfig.class), player, PhaseChangeType.CUSTOM);
}
if (this.bPlayer.isAvatarState()) {
this.damage = getConfig().getInt("Abilities.Avatar.AvatarState.Water.OctopusForm.Damage");
this.attackRange = getConfig().getInt("Abilities.Avatar.AvatarState.Water.OctopusForm.AttackRange");
this.knockback = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.OctopusForm.Knockback");
this.radius = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.OctopusForm.Radius");
this.damage = config.AvatarState_Damage;
this.attackRange = config.AvatarState_AttackRange;
this.knockback = config.AvatarState_Knockback;
this.radius = config.AvatarState_Radius;
}
this.time = System.currentTimeMillis();
this.startTime = System.currentTimeMillis();
@ -146,7 +150,7 @@ public class OctopusForm extends WaterAbility {
}
}
public static void form(final Player player) {
public static void form(final OctopusFormConfig config, final Player player) {
final OctopusForm oldForm = getAbility(player, OctopusForm.class);
if (oldForm != null) {
@ -158,7 +162,7 @@ public class OctopusForm extends WaterAbility {
if (isTransparent(player, block) && isTransparent(player, eyeLoc.getBlock())) {
block.setType(Material.WATER);
block.setBlockData(GeneralMethods.getWaterData(0));
final OctopusForm form = new OctopusForm(player);
final OctopusForm form = new OctopusForm(config, player);
form.setSourceBlock(block);
form.form();
@ -564,19 +568,19 @@ public class OctopusForm extends WaterAbility {
this.formed = formed;
}
public int getRange() {
public double getRange() {
return this.range;
}
public void setRange(final int range) {
public void setRange(final double range) {
this.range = range;
}
public int getDamage() {
public double getDamage() {
return this.damage;
}
public void setDamage(final int damage) {
public void setDamage(final double damage) {
this.damage = damage;
}

View file

@ -19,6 +19,7 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.SurgeConfig;
import com.projectkorra.projectkorra.firebending.FireBlast;
import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
@ -27,9 +28,9 @@ import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
import com.projectkorra.projectkorra.waterbending.util.WaterReturn;
public class SurgeWall extends WaterAbility {
@SuppressWarnings("deprecation")
public class SurgeWall extends WaterAbility<SurgeConfig> {
private static final String RANGE_CONFIG = "Abilities.Water.Surge.Wall.Range";
private static final Map<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<>();
private static final Map<Block, Player> WALL_BLOCKS = new ConcurrentHashMap<>();
public static final List<TempBlock> SOURCE_BLOCKS = new ArrayList<>();
@ -57,14 +58,14 @@ public class SurgeWall extends WaterAbility {
private Vector targetDirection;
private Map<Block, Material> oldTemps;
public SurgeWall(final Player player) {
super(player);
public SurgeWall(final SurgeConfig config, final Player player) {
super(config, player);
this.interval = getConfig().getLong("Abilities.Water.Surge.Wall.Interval");
this.cooldown = getConfig().getLong("Abilities.Water.Surge.Wall.Cooldown");
this.duration = getConfig().getLong("Abilities.Water.Surge.Wall.Duration");
this.range = getConfig().getDouble(RANGE_CONFIG);
this.radius = getConfig().getDouble("Abilities.Water.Surge.Wall.Radius");
this.interval = config.WallConfig.Interval;
this.cooldown = config.WallConfig.Cooldown;
this.duration = config.WallConfig.Duration;
this.range = config.WallConfig.Range;
this.radius = config.WallConfig.Radius;
this.locations = new ArrayList<>();
this.oldTemps = new HashMap<>();
@ -75,7 +76,7 @@ public class SurgeWall extends WaterAbility {
}
if (this.bPlayer.isAvatarState()) {
this.radius = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.Surge.Wall.Radius");
this.radius = config.WallConfig.AvatarState_Radius;
}
final SurgeWall wall = getAbility(player, SurgeWall.class);
@ -104,7 +105,7 @@ public class SurgeWall extends WaterAbility {
final TempBlock tempBlock = new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0));
SOURCE_BLOCKS.add(tempBlock);
wave = new SurgeWave(player);
wave = new SurgeWave(config, player);
wave.setCanHitSelf(false);
wave.moveWater();
@ -411,20 +412,19 @@ public class SurgeWall extends WaterAbility {
return false;
}
public static void form(final Player player) {
public static void form(final SurgeConfig config, final Player player) {
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) {
return;
}
final int range = getConfig().getInt(RANGE_CONFIG);
SurgeWall wall = getAbility(player, SurgeWall.class);
SurgeWave wave = getAbility(player, SurgeWave.class);
if (wave != null) {
if (wave.isProgressing() && !wave.isFreezing()) {
// Freeze the wave.
new SurgeWave(player);
new SurgeWave(config, player);
} else if (wave.isActivateFreeze()) {
wave.remove();
return;
@ -432,7 +432,7 @@ public class SurgeWall extends WaterAbility {
}
if (wall == null) {
final Block source = BlockSource.getWaterSourceBlock(player, range, ClickType.SHIFT_DOWN, true, true, bPlayer.canPlantbend());
final Block source = BlockSource.getWaterSourceBlock(player, config.WallConfig.Range, ClickType.SHIFT_DOWN, true, true, bPlayer.canPlantbend());
if (wave == null && source == null && WaterReturn.hasWaterBottle(player)) {
if (bPlayer.isOnCooldown("SurgeWall")) {
@ -446,7 +446,7 @@ public class SurgeWall extends WaterAbility {
final TempBlock tempBlock = new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0));
SOURCE_BLOCKS.add(tempBlock);
wall = new SurgeWall(player);
wall = new SurgeWall(config, player);
wall.moveWater();
if (!wall.progressing) {
@ -465,12 +465,12 @@ public class SurgeWall extends WaterAbility {
// If SurgeWall isn't being created, then try to source SurgeWave.
if (!bPlayer.isOnCooldown("SurgeWave")) {
wave = new SurgeWave(player);
wave = new SurgeWave(config, player);
}
return;
} else {
if (isWaterbendable(player, null, player.getTargetBlock((HashSet<Material>) null, range))) {
wave = new SurgeWave(player);
if (isWaterbendable(player, null, player.getTargetBlock((HashSet<Material>) null, (int) config.WallConfig.Range))) {
wave = new SurgeWave(config, player);
return;
}
}

View file

@ -22,6 +22,9 @@ import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.SurgeConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.WaterPropertiesConfig;
import com.projectkorra.projectkorra.firebending.FireBlast;
import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
@ -30,7 +33,8 @@ import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
import com.projectkorra.projectkorra.waterbending.util.WaterReturn;
public class SurgeWave extends WaterAbility {
@SuppressWarnings({ "deprecation", "unused" })
public class SurgeWave extends WaterAbility<SurgeConfig> {
private boolean freezing;
private boolean activateFreeze;
@ -63,8 +67,8 @@ public class SurgeWave extends WaterAbility {
private Map<Block, Block> waveBlocks;
private Map<Block, Material> frozenBlocks;
public SurgeWave(final Player player) {
super(player);
public SurgeWave(final SurgeConfig config, final Player player) {
super(config, player);
SurgeWave wave = getAbility(player, SurgeWave.class);
if (wave != null) {
@ -76,20 +80,20 @@ public class SurgeWave extends WaterAbility {
this.canHitSelf = true;
this.currentRadius = 1;
this.cooldown = getConfig().getLong("Abilities.Water.Surge.Wave.Cooldown");
this.interval = getConfig().getLong("Abilities.Water.Surge.Wave.Interval");
this.maxRadius = getConfig().getDouble("Abilities.Water.Surge.Wave.Radius");
this.knockback = getConfig().getDouble("Abilities.Water.Surge.Wave.Knockback");
this.knockup = getConfig().getDouble("Abilities.Water.Surge.Wave.Knockup");
this.maxFreezeRadius = getConfig().getDouble("Abilities.Water.Surge.Wave.MaxFreezeRadius");
this.iceRevertTime = getConfig().getLong("Abilities.Water.Surge.Wave.IceRevertTime");
this.range = getConfig().getDouble("Abilities.Water.Surge.Wave.Range");
this.selectRange = getConfig().getDouble("Abilities.Water.Surge.Wave.SelectRange");
this.cooldown = config.WaveConfig.Cooldown;
this.interval = config.WaveConfig.Interval;
this.maxRadius = config.WaveConfig.Radius;
this.knockback = config.WaveConfig.Knockback;
this.knockup = config.WaveConfig.Knockup;
this.maxFreezeRadius = config.WaveConfig.MaxFreezeRadius;
this.iceRevertTime = config.WaveConfig.IceRevertTime;
this.range = config.WaveConfig.Range;
this.selectRange = config.WaveConfig.SelectRange;
this.waveBlocks = new ConcurrentHashMap<>();
this.frozenBlocks = new ConcurrentHashMap<>();
if (this.bPlayer.isAvatarState()) {
this.maxRadius = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.Surge.Wave.Radius");
this.maxRadius = config.WaveConfig.AvatarState_Radius;
}
this.maxRadius = this.getNightFactor(this.maxRadius);
@ -160,10 +164,10 @@ public class SurgeWave extends WaterAbility {
if (Commands.invincible.contains(((Player) entity).getName())) {
return;
}
if (!getConfig().getBoolean("Properties.Water.FreezePlayerHead") && GeneralMethods.playerHeadIsInBlock((Player) entity, block)) {
if (!ConfigManager.getConfig(WaterPropertiesConfig.class).FreezePlayerHead && GeneralMethods.playerHeadIsInBlock((Player) entity, block)) {
continue ICE_SETTING;
}
if (!getConfig().getBoolean("Properties.Water.FreezePlayerFeet") && GeneralMethods.playerFeetIsInBlock((Player) entity, block)) {
if (!ConfigManager.getConfig(WaterPropertiesConfig.class).FreezePlayerFeet && GeneralMethods.playerFeetIsInBlock((Player) entity, block)) {
continue ICE_SETTING;
}
}

View file

@ -8,7 +8,6 @@ import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang3.tuple.Pair;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -24,6 +23,9 @@ import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.TorrentConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.WaterPropertiesConfig;
import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
@ -32,7 +34,8 @@ import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
import com.projectkorra.projectkorra.waterbending.util.WaterReturn;
public class Torrent extends WaterAbility {
@SuppressWarnings({ "deprecation", "unused" })
public class Torrent extends WaterAbility<TorrentConfig> {
private static final double CLEANUP_RANGE = 50;
private static final Map<TempBlock, Pair<Player, Integer>> FROZEN_BLOCKS = new ConcurrentHashMap<>();
@ -79,26 +82,26 @@ public class Torrent extends WaterAbility {
private ArrayList<TempBlock> launchedBlocks;
private ArrayList<Entity> hurtEntities;
public Torrent(final Player player) {
super(player);
public Torrent(final TorrentConfig config, final Player player) {
super(config, player);
this.layer = 0;
this.startAngle = 0;
this.maxLayer = getConfig().getInt("Abilities.Water.Torrent.MaxLayer");
this.knockback = getConfig().getDouble("Abilities.Water.Torrent.Knockback");
this.angle = getConfig().getDouble("Abilities.Water.Torrent.Angle");
this.radius = getConfig().getDouble("Abilities.Water.Torrent.Radius");
this.knockup = getConfig().getDouble("Abilities.Water.Torrent.Knockup");
this.interval = getConfig().getLong("Abilities.Water.Torrent.Interval");
this.damage = getConfig().getDouble("Abilities.Water.Torrent.InitialDamage");
this.successiveDamage = getConfig().getDouble("Abilities.Water.Torrent.SuccessiveDamage");
this.maxHits = getConfig().getInt("Abilities.Water.Torrent.MaxHits");
this.deflectDamage = getConfig().getDouble("Abilities.Water.Torrent.DeflectDamage");
this.range = getConfig().getDouble("Abilities.Water.Torrent.Range");
this.selectRange = getConfig().getDouble("Abilities.Water.Torrent.SelectRange");
this.cooldown = getConfig().getLong("Abilities.Water.Torrent.Cooldown");
this.revert = getConfig().getBoolean("Abilities.Water.Torrent.Revert");
this.revertTime = getConfig().getLong("Abilities.Water.Torrent.RevertTime");
this.maxLayer = config.MaxLayer;
this.knockback = config.Knockback;
this.angle = config.Angle;
this.radius = config.Radius;
this.knockup = config.Knockup;
this.interval = config.Interval;
this.damage = config.InitialDamage;
this.successiveDamage = config.SuccessiveDamage;
this.maxHits = config.MaxHits;
this.deflectDamage = config.DeflectDamage;
this.range = config.Range;
this.selectRange = config.SelectRange;
this.cooldown = config.Cooldown;
this.revert = config.Revert;
this.revertTime = config.RevertTime;
this.blocks = new ArrayList<>();
this.launchedBlocks = new ArrayList<>();
this.hurtEntities = new ArrayList<>();
@ -119,10 +122,10 @@ public class Torrent extends WaterAbility {
}
if (this.bPlayer.isAvatarState()) {
this.knockback = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.Torrent.Push");
this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.Torrent.InitialDamage");
this.successiveDamage = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.Torrent.SuccessiveDamage");
this.maxHits = getConfig().getInt("Abilities.Avatar.AvatarState.Water.Torrent.MaxHits");
this.knockback = config.AvatarState_Knockback;
this.damage = config.AvatarState_InitialDamage;
this.successiveDamage = config.AvatarState_SuccessiveDamage;
this.maxHits = config.AvatarState_MaxHits;
}
this.time = System.currentTimeMillis();
@ -148,10 +151,10 @@ public class Torrent extends WaterAbility {
if (Commands.invincible.contains(((Player) entity).getName())) {
return;
}
if (!getConfig().getBoolean("Properties.Water.FreezePlayerHead") && GeneralMethods.playerHeadIsInBlock((Player) entity, block)) {
if (!ConfigManager.getConfig(WaterPropertiesConfig.class).FreezePlayerHead && GeneralMethods.playerHeadIsInBlock((Player) entity, block)) {
continue ICE_SETTING;
}
if (!getConfig().getBoolean("Properties.Water.FreezePlayerFeet") && GeneralMethods.playerFeetIsInBlock((Player) entity, block)) {
if (!ConfigManager.getConfig(WaterPropertiesConfig.class).FreezePlayerFeet && GeneralMethods.playerFeetIsInBlock((Player) entity, block)) {
continue ICE_SETTING;
}
}
@ -302,7 +305,7 @@ public class Torrent extends WaterAbility {
}
if (this.formed && !this.player.isSneaking() && !this.launch) {
new TorrentWave(this.player, this.radius);
new TorrentWave(config, this.player, this.radius);
this.remove();
return;
}
@ -531,7 +534,7 @@ public class Torrent extends WaterAbility {
new WaterReturn(this.player, location.getBlock());
}
public static void create(final Player player) {
public static void create(final TorrentConfig config, final Player player) {
if (hasAbility(player, Torrent.class)) {
return;
}
@ -544,7 +547,7 @@ public class Torrent extends WaterAbility {
block.setType(Material.WATER);
block.setBlockData(GeneralMethods.getWaterData(0));
}
final Torrent tor = new Torrent(player);
final Torrent tor = new Torrent(config, player);
if (tor.sourceSelected || tor.settingUp) {
WaterReturn.emptyWaterBottle(player);

View file

@ -17,10 +17,12 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.TorrentConfig;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.util.WaterReturn;
public class TorrentWave extends WaterAbility {
@SuppressWarnings("deprecation")
public class TorrentWave extends WaterAbility<TorrentConfig> {
private long time;
private long interval;
@ -40,24 +42,24 @@ public class TorrentWave extends WaterAbility {
private ArrayList<Entity> affectedEntities;
private Map<Integer, ConcurrentHashMap<Integer, Double>> heights;
public TorrentWave(final Player player, final double radius) {
this(player, player.getEyeLocation(), radius);
public TorrentWave(final TorrentConfig config, final Player player, final double radius) {
this(config, player, player.getEyeLocation(), radius);
}
public TorrentWave(final Player player, final Location location, final double radius) {
super(player);
public TorrentWave(final TorrentConfig config, final Player player, final Location location, final double radius) {
super(config, player);
if (this.bPlayer.isOnCooldown("TorrentWave")) {
return;
}
this.radius = radius;
this.interval = getConfig().getLong("Abilities.Water.Torrent.Wave.Interval");
this.maxHeight = getConfig().getDouble("Abilities.Water.Torrent.Wave.Height");
this.maxRadius = getConfig().getDouble("Abilities.Water.Torrent.Wave.Radius");
this.knockback = getConfig().getDouble("Abilities.Water.Torrent.Wave.Knockback");
this.cooldown = getConfig().getLong("Abilities.Water.Torrent.Wave.Cooldown");
this.growSpeed = getConfig().getDouble("Abilities.Water.Torrent.Wave.GrowSpeed");
this.interval = config.WaveConfig.Interval;
this.maxHeight = config.WaveConfig.Height;
this.maxRadius = config.WaveConfig.Radius;
this.knockback = config.WaveConfig.Knockback;
this.cooldown = config.WaveConfig.Cooldown;
this.growSpeed = config.WaveConfig.GrowSpeed;
this.origin = location.clone();
this.time = System.currentTimeMillis();
this.heights = new ConcurrentHashMap<>();

View file

@ -18,10 +18,10 @@ import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.WaterBubbleConfig;
import com.projectkorra.projectkorra.util.TempBlock;
public class WaterBubble extends WaterAbility {
public class WaterBubble extends WaterAbility<WaterBubbleConfig> {
@Attribute("Click" + Attribute.DURATION)
private long clickDuration;
@ -39,8 +39,8 @@ public class WaterBubble extends WaterAbility {
private Location location;
private long lastActivation; // When the last click happened.
public WaterBubble(final Player player, final boolean isShift) {
super(player);
public WaterBubble(final WaterBubbleConfig config, final Player player, final boolean isShift) {
super(config, player);
this.setFields();
@ -77,10 +77,10 @@ public class WaterBubble extends WaterAbility {
}
public void setFields() {
this.clickDuration = ConfigManager.defaultConfig.get().getLong("Abilities.Water.WaterBubble.ClickDuration");
this.maxRadius = ConfigManager.defaultConfig.get().getDouble("Abilities.Water.WaterBubble.Radius");
this.speed = ConfigManager.defaultConfig.get().getDouble("Abilities.Water.WaterBubble.Speed");
this.requireAir = ConfigManager.defaultConfig.get().getBoolean("Abilities.Water.WaterBubble.MustStartAboveWater");
this.clickDuration = config.ClickDuration;
this.maxRadius = config.Radius;
this.speed = config.Speed;
this.requireAir = config.MustStartAboveWater;
}
@Override

View file

@ -21,6 +21,7 @@ import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.WaterManipulationConfig;
import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
@ -30,7 +31,8 @@ import com.projectkorra.projectkorra.waterbending.ice.PhaseChange;
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
import com.projectkorra.projectkorra.waterbending.util.WaterReturn;
public class WaterManipulation extends WaterAbility {
@SuppressWarnings("deprecation")
public class WaterManipulation extends WaterAbility<WaterManipulationConfig> {
private static final Map<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<>();
@ -67,25 +69,25 @@ public class WaterManipulation extends WaterAbility {
private Vector targetDirection;
private final HashSet<Byte> waterTypes;
public WaterManipulation(final Player player) {
this(player, prepare(player, getConfig().getDouble("Abilities.Water.WaterManipulation.SelectRange")));
public WaterManipulation(final WaterManipulationConfig config, final Player player) {
this(config, player, prepare(player, config.SelectRange));
}
public WaterManipulation(final Player player, final Block source) {
super(player);
public WaterManipulation(final WaterManipulationConfig config, final Player player, final Block source) {
super(config, player);
this.progressing = false;
this.falling = false;
this.settingUp = false;
this.displacing = false;
this.collisionRadius = getConfig().getDouble("Abilities.Water.WaterManipulation.CollisionRadius");
this.cooldown = getConfig().getLong("Abilities.Water.WaterManipulation.Cooldown");
this.selectRange = getConfig().getDouble("Abilities.Water.WaterManipulation.SelectRange");
this.range = getConfig().getDouble("Abilities.Water.WaterManipulation.Range");
this.knockback = getConfig().getDouble("Abilities.Water.WaterManipulation.Knockback");
this.damage = getConfig().getDouble("Abilities.Water.WaterManipulation.Damage");
this.speed = getConfig().getDouble("Abilities.Water.WaterManipulation.Speed");
this.deflectRange = getConfig().getDouble("Abilities.Water.WaterManipulation.DeflectRange");
this.collisionRadius = config.CollisionRadius;
this.cooldown = config.Cooldown;
this.selectRange = config.SelectRange;
this.range = config.Range;
this.knockback = config.Knockback;
this.damage = config.Damage;
this.speed = config.Speed;
this.deflectRange = config.DeflectRange;
this.waterTypes = new HashSet<Byte>();
this.interval = (long) (1000. / this.speed);
@ -286,7 +288,7 @@ public class WaterManipulation extends WaterAbility {
entity.setVelocity(vector.normalize().multiply(this.knockback));
if (this.bPlayer.isAvatarState()) {
this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.WaterManipulation.Damage");
this.damage = config.AvatarState_Damage;
}
this.damage = this.getNightFactor(this.damage);
DamageHandler.damageEntity(entity, this.damage, this);
@ -465,7 +467,7 @@ public class WaterManipulation extends WaterAbility {
return location;
}
public static void moveWater(final Player player) {
public static void moveWater(final WaterManipulationConfig config, final Player player) {
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) {
return;
@ -502,7 +504,7 @@ public class WaterManipulation extends WaterAbility {
if (getTargetLocation(player, range).distanceSquared(block.getLocation()) > 1) {
final TempBlock tb = new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0));
final WaterManipulation waterManip = new WaterManipulation(player, block);
final WaterManipulation waterManip = new WaterManipulation(config, player, block);
waterManip.moveWater();
if (!waterManip.progressing) {
block.setType(Material.AIR);

View file

@ -17,10 +17,12 @@ import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.WaterSpoutConfig;
import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock;
public class WaterSpout extends WaterAbility {
@SuppressWarnings("deprecation")
public class WaterSpout extends WaterAbility<WaterSpoutConfig> {
private static final Map<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<Block, Block>();
private final List<TempBlock> blocks = new ArrayList<TempBlock>();
@ -44,8 +46,8 @@ public class WaterSpout extends WaterAbility {
private Block base;
private TempBlock baseBlock;
public WaterSpout(final Player player) {
super(player);
public WaterSpout(final WaterSpoutConfig config, final Player player) {
super(config, player);
final WaterSpout oldSpout = getAbility(player, WaterSpout.class);
if (oldSpout != null) {
@ -53,17 +55,17 @@ public class WaterSpout extends WaterAbility {
return;
}
this.canBendOnPackedIce = getConfig().getStringList("Properties.Water.IceBlocks").contains(Material.PACKED_ICE.toString());
this.useParticles = getConfig().getBoolean("Abilities.Water.WaterSpout.Particles");
this.useBlockSpiral = getConfig().getBoolean("Abilities.Water.WaterSpout.BlockSpiral");
this.cooldown = getConfig().getLong("Abilities.Water.WaterSpout.Cooldown");
this.height = getConfig().getDouble("Abilities.Water.WaterSpout.Height");
this.interval = getConfig().getLong("Abilities.Water.WaterSpout.Interval");
this.duration = getConfig().getLong("Abilities.Water.WaterSpout.Duration");
this.canBendOnPackedIce = isIce(Material.PACKED_ICE);
this.useParticles = config.UseParticles;
this.useBlockSpiral = config.EnableBlockSpiral;
this.cooldown = config.Cooldown;
this.height = config.Height;
this.interval = config.Interval;
this.duration = config.Duration;
this.startTime = System.currentTimeMillis();
this.maxHeight = this.getNightFactor(this.height);
final WaterSpoutWave spoutWave = new WaterSpoutWave(player, WaterSpoutWave.AbilityType.CLICK);
final WaterSpoutWave spoutWave = new WaterSpoutWave(config, player, WaterSpoutWave.AbilityType.CLICK);
if (spoutWave.isStarted() && !spoutWave.isRemoved()) {
return;
}

View file

@ -26,12 +26,18 @@ import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
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.water.IceWaveConfig;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.WaterSpoutConfig;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.WaterSpoutConfig.WaterSpoutWaveConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.WaterPropertiesConfig;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.combo.IceWave;
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
public class WaterSpoutWave extends WaterAbility {
@SuppressWarnings({ "deprecation", "unused" })
public class WaterSpoutWave extends WaterAbility<WaterSpoutConfig> {
public static enum AbilityType {
CLICK, SHIFT, RELEASE
@ -81,26 +87,26 @@ public class WaterSpoutWave extends WaterAbility {
private ArrayList<BukkitRunnable> tasks;
private ConcurrentHashMap<Block, TempBlock> affectedBlocks;
public WaterSpoutWave(final Player player, final AbilityType type) {
super(player);
public WaterSpoutWave(final WaterSpoutConfig config, final Player player, final AbilityType type) {
super(config, player);
this.charging = false;
this.iceWave = false;
this.iceOnly = false;
this.collidable = false;
this.plant = getConfig().getBoolean("Abilities.Water.WaterSpout.Wave.AllowPlantSource");
this.radius = getConfig().getDouble("Abilities.Water.WaterSpout.Wave.Radius");
this.waveRadius = getConfig().getDouble("Abilities.Water.WaterSpout.Wave.WaveRadius");
this.thawRadius = getConfig().getDouble("Abilities.Water.IceWave.ThawRadius");
this.animationSpeed = getConfig().getDouble("Abilities.Water.WaterSpout.Wave.AnimationSpeed");
this.selectRange = getConfig().getDouble("Abilities.Water.WaterSpout.Wave.SelectRange");
this.speed = getConfig().getDouble("Abilities.Water.WaterSpout.Wave.Speed");
this.damage = getConfig().getDouble("Abilities.Water.IceWave.Damage");
this.chargeTime = getConfig().getLong("Abilities.Water.WaterSpout.Wave.ChargeTime");
this.flightDuration = getConfig().getLong("Abilities.Water.WaterSpout.Wave.FlightDuration");
this.cooldown = getConfig().getLong("Abilities.Water.WaterSpout.Wave.Cooldown");
this.revertSphereTime = getConfig().getLong("Abilities.Water.IceWave.RevertSphereTime");
this.revertIceSphere = getConfig().getBoolean("Abilities.Water.IceWave.RevertSphere");
this.plant = config.WaveConfig.AllowPlantSource;
this.radius = config.WaveConfig.Radius;
this.waveRadius = config.WaveConfig.WaveRadius;
this.thawRadius = 0;
this.animationSpeed = config.WaveConfig.AnimationSpeed;
this.selectRange = config.WaveConfig.SelectRange;
this.speed = config.WaveConfig.Speed;
this.damage = 0;
this.chargeTime = config.WaveConfig.ChargeTime;
this.flightDuration = config.WaveConfig.FlightDuration;
this.cooldown = config.WaveConfig.Cooldown;
this.revertSphereTime = 0;
this.revertIceSphere = false;
this.affectedBlocks = new ConcurrentHashMap<>();
this.affectedEntities = new ArrayList<>();
this.tasks = new ArrayList<>();
@ -113,8 +119,7 @@ public class WaterSpoutWave extends WaterAbility {
if (this.bPlayer.isAvatarState()) {
this.chargeTime = 0;
this.flightDuration = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.WaterWave.FlightDuration");
this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.IceWave.Damage");
this.flightDuration = config.WaveConfig.AvatarState_FlightDuration;
this.cooldown = 0;
}
@ -429,10 +434,10 @@ public class WaterSpoutWave extends WaterAbility {
if (Commands.invincible.contains(((Player) entity).getName())) {
return;
}
if (!getConfig().getBoolean("Properties.Water.FreezePlayerHead") && GeneralMethods.playerHeadIsInBlock((Player) entity, block)) {
if (!ConfigManager.getConfig(WaterPropertiesConfig.class).FreezePlayerHead && GeneralMethods.playerHeadIsInBlock((Player) entity, block)) {
continue;
}
if (!getConfig().getBoolean("Properties.Water.FreezePlayerFeet") && GeneralMethods.playerFeetIsInBlock((Player) entity, block)) {
if (!ConfigManager.getConfig(WaterPropertiesConfig.class).FreezePlayerFeet && GeneralMethods.playerFeetIsInBlock((Player) entity, block)) {
continue;
}
}
@ -579,8 +584,19 @@ public class WaterSpoutWave extends WaterAbility {
return this.iceWave;
}
public void setIceWave(final boolean iceWave) {
this.iceWave = iceWave;
public void setIceWave(final IceWaveConfig iceConfig) {
this.iceWave = iceConfig != null;
if (iceConfig != null) {
this.thawRadius = iceConfig.ThawRadius;
this.damage = iceConfig.Damage;
this.revertSphereTime = iceConfig.RevertSphereTime;
this.revertIceSphere = iceConfig.RevertSphere;
if (this.bPlayer.isAvatarState()) {
this.damage = iceConfig.AvatarState_Damage;
}
}
}
public boolean isIceOnly() {
@ -590,10 +606,10 @@ public class WaterSpoutWave extends WaterAbility {
public void setIceOnly(final boolean iceOnly) {
this.iceOnly = iceOnly;
}
@Override
public boolean isEnabled() {
return getConfig().getBoolean("Abilities.Water.WaterSpout.Wave.Enabled");
return config.WaveConfig.Enabled;
}
public boolean isMoving() {

View file

@ -22,11 +22,12 @@ import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.BloodAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.BloodbendingConfig;
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempPotionEffect;
public class Bloodbending extends BloodAbility {
public class Bloodbending extends BloodAbility<BloodbendingConfig> {
private static final Map<Entity, Player> TARGETED_ENTITIES = new ConcurrentHashMap<Entity, Player>();
@ -37,7 +38,7 @@ public class Bloodbending extends BloodAbility {
@Attribute("CanBloodbendOtherBloodbenders")
private boolean canBloodbendOtherBloodbenders;
@Attribute(Attribute.RANGE)
private int range;
private double range;
private long time;
@Attribute(Attribute.DURATION)
private long duration;
@ -48,8 +49,8 @@ public class Bloodbending extends BloodAbility {
private Entity target;
private Vector vector;
public Bloodbending(final Player player) {
super(player);
public Bloodbending(final BloodbendingConfig config, final Player player) {
super(config, player);
final Bloodbending ability = getAbility(player, Bloodbending.class);
if (ability != null) {
@ -57,14 +58,14 @@ public class Bloodbending extends BloodAbility {
return;
}
this.canOnlyBeUsedAtNight = getConfig().getBoolean("Abilities.Water.Bloodbending.CanOnlyBeUsedAtNight");
this.canBeUsedOnUndeadMobs = getConfig().getBoolean("Abilities.Water.Bloodbending.CanBeUsedOnUndeadMobs");
this.onlyUsableDuringMoon = getConfig().getBoolean("Abilities.Water.Bloodbending.CanOnlyBeUsedDuringFullMoon");
this.canBloodbendOtherBloodbenders = getConfig().getBoolean("Abilities.Water.Bloodbending.CanBloodbendOtherBloodbenders");
this.range = getConfig().getInt("Abilities.Water.Bloodbending.Range");
this.duration = getConfig().getInt("Abilities.Water.Bloodbending.Duration");
this.cooldown = getConfig().getInt("Abilities.Water.Bloodbending.Cooldown");
this.knockback = getConfig().getDouble("Abilities.Water.Bloodbending.Knockback");
this.canOnlyBeUsedAtNight = config.CanOnlyBeUsedAtNight;
this.canBeUsedOnUndeadMobs = config.CanBeUsedOnUndeadMobs;
this.onlyUsableDuringMoon = config.CanOnlyBeUsedDuringFullMoon;
this.canBloodbendOtherBloodbenders = config.CanBloodbendOtherBloodbenders;
this.range = config.Range;
this.duration = config.Duration;
this.cooldown = config.Cooldown;
this.knockback = config.Knockback;
this.vector = new Vector(0, 0, 0);
if (this.canOnlyBeUsedAtNight && !isNight(player.getWorld()) && !this.bPlayer.canBloodbendAtAnytime()) {
@ -404,11 +405,11 @@ public class Bloodbending extends BloodAbility {
this.canBloodbendOtherBloodbenders = canBloodbendOtherBloodbenders;
}
public int getRange() {
public double getRange() {
return this.range;
}
public void setRange(final int range) {
public void setRange(final double range) {
this.range = range;
}

View file

@ -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.configs.abilities.water.IceBulletConfig;
import com.projectkorra.projectkorra.firebending.combo.FireComboStream;
import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
@ -33,7 +34,8 @@ import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.util.WaterSourceGrabber;
public class IceBullet extends IceAbility implements ComboAbility {
@SuppressWarnings("deprecation")
public class IceBullet extends IceAbility<IceBulletConfig> implements ComboAbility<IceBulletConfig> {
public static enum AbilityState {
ICE_PILLAR_RISING, ICE_BULLET_FORMING
@ -58,7 +60,6 @@ public class IceBullet extends IceAbility implements ComboAbility {
private long cooldown;
private long shotcooldown;
private long time;
private String name;
private AbilityState state;
private Location origin;
private Location location;
@ -67,8 +68,8 @@ public class IceBullet extends IceAbility implements ComboAbility {
private ArrayList<BukkitRunnable> tasks;
private ConcurrentHashMap<Block, TempBlock> affectedBlocks;
public IceBullet(final Player player) {
super(player);
public IceBullet(final IceBulletConfig config, final Player player) {
super(config, player);
this.time = System.currentTimeMillis();
this.tasks = new ArrayList<>();
@ -78,16 +79,15 @@ public class IceBullet extends IceAbility implements ComboAbility {
return;
}
this.damage = getConfig().getDouble("Abilities.Water.IceBullet.Damage");
this.range = getConfig().getDouble("Abilities.Water.IceBullet.Range");
this.radius = getConfig().getDouble("Abilities.Water.IceBullet.Radius");
this.cooldown = getConfig().getLong("Abilities.Water.IceBullet.Cooldown");
this.shotcooldown = getConfig().getLong("Abilities.Water.IceBullet.ShotCooldown");
this.shootTime = getConfig().getLong("Abilities.Water.IceBullet.ShootTime");
this.maxShots = getConfig().getInt("Abilities.Water.IceBullet.MaxShots");
this.animationSpeed = getConfig().getDouble("Abilities.Water.IceBullet.AnimationSpeed");
this.damage = config.Damage;
this.range = config.Range;
this.radius = config.Radius;
this.cooldown = config.Cooldown;
this.shotcooldown = config.ShotCooldown;
this.shootTime = config.ShootTime;
this.maxShots = config.MaxShots;
this.animationSpeed = config.AnimationSpeed;
this.speed = 1;
this.name = this.getName();
double aug = getNightFactor(player.getWorld());
if (aug > 1) {
@ -101,7 +101,7 @@ public class IceBullet extends IceAbility implements ComboAbility {
this.radius *= aug;
if (this.bPlayer.isAvatarState()) {
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Water.IceBullet.Cooldown");
this.cooldown = config.AvatarState_Cooldown;
this.damage = AvatarState.getValue(this.damage);
this.range = AvatarState.getValue(this.range);
this.shootTime = AvatarState.getValue(this.shootTime);
@ -343,8 +343,8 @@ public class IceBullet extends IceAbility implements ComboAbility {
}
@Override
public Object createNewComboInstance(final Player player) {
return new IceBullet(player);
public Object createNewComboInstance(final IceBulletConfig config, final Player player) {
return new IceBullet(config, player);
}
@Override
@ -520,7 +520,4 @@ public class IceBullet extends IceAbility implements ComboAbility {
this.location = location;
}
public void setName(final String name) {
this.name = name;
}
}

View file

@ -12,11 +12,12 @@ 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.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<IceWaveConfig> implements ComboAbility<IceWaveConfig> {
private static final Map<Block, TempBlock> FROZEN_BLOCKS = new ConcurrentHashMap<>();
@ -24,8 +25,8 @@ public class IceWave extends IceAbility implements ComboAbility {
private long cooldown;
private Location origin;
public IceWave(final Player player) {
super(player);
public IceWave(final IceWaveConfig config, final Player player) {
super(config, player);
if (!this.bPlayer.canBendIgnoreBindsCooldowns(this)) {
return;
@ -36,7 +37,7 @@ public class IceWave extends IceAbility implements ComboAbility {
return;
}
this.cooldown = getConfig().getLong("Abilities.Water.IceWave.Cooldown");
this.cooldown = config.Cooldown;
if (this.bPlayer.isAvatarState()) {
this.cooldown = 0;
@ -62,7 +63,7 @@ public class IceWave extends IceAbility implements ComboAbility {
this.origin = this.player.getLocation();
final WaterSpoutWave wave = WaterSpoutWave.getType(this.player, WaterSpoutWave.AbilityType.RELEASE).get(0);
wave.setIceWave(true);
wave.setIceWave(config);
} else if (!WaterSpoutWave.containsType(this.player, WaterSpoutWave.AbilityType.RELEASE)) {
this.remove();
return;
@ -114,8 +115,8 @@ public class IceWave extends IceAbility implements ComboAbility {
}
@Override
public Object createNewComboInstance(final Player player) {
return new IceWave(player);
public Object createNewComboInstance(final IceWaveConfig config, final Player player) {
return new IceWave(config, player);
}
@Override

View file

@ -20,10 +20,12 @@ import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.HealingAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.chiblocking.Smokescreen;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.HealingWatersConfig;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.util.WaterReturn;
public class HealingWaters extends HealingAbility {
@SuppressWarnings("deprecation")
public class HealingWaters extends HealingAbility<HealingWatersConfig> {
// Configurable Variables.
@Attribute(Attribute.COOLDOWN)
@ -55,8 +57,8 @@ public class HealingWaters extends HealingAbility {
private boolean hasReached = false;
private String hex;
public HealingWaters(final Player player) {
super(player);
public HealingWaters(final HealingWatersConfig config, final Player player) {
super(config, player);
if (!this.bPlayer.canBend(this)) {
this.remove();
@ -77,13 +79,13 @@ public class HealingWaters extends HealingAbility {
public void setFields() {
this.cooldown = getConfig().getLong("Abilities.Water.HealingWaters.Cooldown");
this.range = getConfig().getDouble("Abilities.Water.HealingWaters.Range");
this.interval = getConfig().getLong("Abilities.Water.HealingWaters.Interval");
this.chargeTime = getConfig().getLong("Abilities.Water.HealingWaters.ChargeTime");
this.potionPotency = getConfig().getInt("Abilities.Water.HealingWaters.PotionPotency");
this.duration = getConfig().getLong("Abilities.Water.HealingWaters.Duration");
this.enableParticles = getConfig().getBoolean("Abilities.Water.HealingWaters.EnableParticles");
this.cooldown = config.Cooldown;
this.range = config.Range;
this.interval = config.Interval;
this.chargeTime = config.ChargeTime;
this.potionPotency = config.PotionPotency;
this.duration = config.Duration;
this.enableParticles = config.EnableParticles;
this.hex = "00ffff";
}

View file

@ -20,6 +20,7 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.IceBlastConfig;
import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
@ -28,7 +29,7 @@ import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.util.TempPotionEffect;
import com.projectkorra.projectkorra.waterbending.util.WaterReturn;
public class IceBlast extends IceAbility {
public class IceBlast extends IceAbility<IceBlastConfig> {
private boolean prepared;
private boolean settingUp;
@ -52,17 +53,17 @@ public class IceBlast extends IceAbility {
private boolean allowSnow;
public TempBlock source;
public IceBlast(final Player player) {
super(player);
public IceBlast(final IceBlastConfig config, final Player player) {
super(config, player);
this.data = 0;
this.interval = getConfig().getLong("Abilities.Water.IceBlast.Interval");
this.collisionRadius = getConfig().getDouble("Abilities.Water.IceBlast.CollisionRadius");
this.deflectRange = getConfig().getDouble("Abilities.Water.IceBlast.DeflectRange");
this.range = getConfig().getDouble("Abilities.Water.IceBlast.Range");
this.damage = getConfig().getInt("Abilities.Water.IceBlast.Damage");
this.cooldown = getConfig().getInt("Abilities.Water.IceBlast.Cooldown");
this.allowSnow = getConfig().getBoolean("Abilities.Water.IceBlast.AllowSnow");
this.interval = config.Interval;
this.collisionRadius = config.CollisionRadius;
this.deflectRange = config.DeflectRange;
this.range = config.Range;
this.damage = config.Damage;
this.cooldown = config.Cooldown;
this.allowSnow = config.AllowSnow;
this.damage = getNightFactor(this.damage, player.getWorld());
@ -71,9 +72,9 @@ public class IceBlast extends IceAbility {
}
if (this.bPlayer.isAvatarState()) {
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Water.IceBlast.Cooldown");
this.range = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.IceBlast.Range");
this.damage = getConfig().getInt("Abilities.Avatar.AvatarState.Water.IceBlast.Damage");
this.cooldown = config.AvatarState_Cooldown;
this.range = config.AvatarState_Range;
this.damage = config.AvatarState_Damage;
}
block(player);

View file

@ -18,13 +18,14 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.IceSpikeConfig;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.util.TempPotionEffect;
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
import com.projectkorra.projectkorra.waterbending.util.WaterReturn;
public class IceSpikeBlast extends IceAbility {
public class IceSpikeBlast extends IceAbility<IceSpikeConfig> {
private boolean prepared;
private boolean settingUp;
@ -54,23 +55,23 @@ public class IceSpikeBlast extends IceAbility {
private TempBlock source;
private Material sourceType;
public IceSpikeBlast(final Player player) {
super(player);
public IceSpikeBlast(final IceSpikeConfig config, final Player player) {
super(config, player);
if (this.bPlayer.isOnCooldown("IceSpikeBlast")) {
return;
}
this.data = 0;
this.interval = getConfig().getLong("Abilities.Water.IceSpike.Blast.Interval");
this.slowCooldown = getConfig().getLong("Abilities.Water.IceSpike.Blast.SlowCooldown");
this.collisionRadius = getConfig().getDouble("Abilities.Water.IceSpike.Blast.CollisionRadius");
this.deflectRange = getConfig().getDouble("Abilities.Water.IceSpike.Blast.DeflectRange");
this.range = getConfig().getDouble("Abilities.Water.IceSpike.Blast.Range");
this.damage = getConfig().getDouble("Abilities.Water.IceSpike.Blast.Damage");
this.cooldown = getConfig().getLong("Abilities.Water.IceSpike.Blast.Cooldown");
this.slowPotency = getConfig().getInt("Abilities.Water.IceSpike.Blast.SlowPotency");
this.slowDuration = getConfig().getInt("Abilities.Water.IceSpike.Blast.SlowDuration");
this.interval = config.BlastConfig.Interval;
this.slowCooldown = config.BlastConfig.SlowCooldown;
this.collisionRadius = config.BlastConfig.CollisionRadius;
this.deflectRange = config.BlastConfig.DeflectRange;
this.range = config.BlastConfig.Range;
this.damage = config.BlastConfig.Damage;
this.cooldown = config.BlastConfig.Cooldown;
this.slowPotency = config.BlastConfig.SlowPotency;
this.slowDuration = config.BlastConfig.SlowDuration;
if (!this.bPlayer.canBend(this) || !this.bPlayer.canIcebend()) {
return;
@ -79,10 +80,10 @@ public class IceSpikeBlast extends IceAbility {
if (this.bPlayer.isAvatarState()) {
this.cooldown = 0;
this.slowCooldown = 0;
this.range = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.IceSpike.Blast.Range");
this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.IceSpike.Blast.Damage");
this.slowPotency = getConfig().getInt("Abilities.Avatar.AvatarState.Water.IceSpike.Blast.SlowPotency");
this.slowDuration = getConfig().getInt("Abilities.Avatar.AvatarState.Water.IceSpike.Blast.SlowDuration");
this.range = config.BlastConfig.AvatarState_Range;
this.damage = config.BlastConfig.AvatarState_Damage;
this.slowPotency = config.BlastConfig.AvatarState_SlowPotency;
this.slowDuration = config.BlastConfig.AvatarState_SlowDuration;
}
block(player);
@ -95,7 +96,7 @@ public class IceSpikeBlast extends IceAbility {
}
if (this.sourceBlock == null) {
new IceSpikePillarField(player);
new IceSpikePillarField(config, player);
} else if (GeneralMethods.isRegionProtectedFromBuild(this, this.sourceBlock.getLocation())) {
return;
} else {
@ -295,7 +296,7 @@ public class IceSpikeBlast extends IceAbility {
}
}
public static void activate(final Player player) {
public static void activate(final IceSpikeConfig config, final Player player) {
redirect(player);
boolean activate = false;
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
@ -317,9 +318,9 @@ public class IceSpikeBlast extends IceAbility {
}
if (!activate && !getPlayers(IceSpikeBlast.class).contains(player)) {
final IceSpikePillar spike = new IceSpikePillar(player);
final IceSpikePillar spike = new IceSpikePillar(config, player);
if (!spike.isStarted()) {
waterBottle(player);
waterBottle(config, player);
}
}
}
@ -387,21 +388,19 @@ public class IceSpikeBlast extends IceAbility {
}
}
private static void waterBottle(final Player player) {
final long range = getConfig().getLong("Abilities.Water.IceSpike.Projectile.Range");
private static void waterBottle(final IceSpikeConfig config, final Player player) {
if (WaterReturn.hasWaterBottle(player)) {
final Location eyeLoc = player.getEyeLocation();
final Block block = eyeLoc.add(eyeLoc.getDirection().normalize()).getBlock();
if (isTransparent(player, block) && isTransparent(player, eyeLoc.getBlock())) {
final LivingEntity target = (LivingEntity) GeneralMethods.getTargetedEntity(player, range);
final LivingEntity target = (LivingEntity) GeneralMethods.getTargetedEntity(player, config.BlastConfig.ProjectileRange);
Location destination;
if (target == null) {
destination = GeneralMethods.getTargetedLocation(player, range, getTransparentMaterials());
destination = GeneralMethods.getTargetedLocation(player, config.BlastConfig.ProjectileRange, getTransparentMaterials());
} else {
destination = GeneralMethods.getPointOnLine(player.getEyeLocation(), target.getEyeLocation(), range);
destination = GeneralMethods.getPointOnLine(player.getEyeLocation(), target.getEyeLocation(), config.BlastConfig.ProjectileRange);
}
if (destination.distanceSquared(block.getLocation()) < 1) {
@ -411,7 +410,7 @@ public class IceSpikeBlast extends IceAbility {
final BlockState state = block.getState();
block.setType(Material.WATER);
block.setBlockData(GeneralMethods.getWaterData(0));
final IceSpikeBlast iceSpike = new IceSpikeBlast(player);
final IceSpikeBlast iceSpike = new IceSpikeBlast(config, player);
iceSpike.throwIce();
iceSpike.sourceBlock = null;

View file

@ -22,14 +22,15 @@ import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.IceSpikeConfig;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.util.TempPotionEffect;
public class IceSpikePillar extends IceAbility {
public class IceSpikePillar extends IceAbility<IceSpikeConfig> {
/** The list of blocks IceSpike uses */
private final Map<Block, TempBlock> ice_blocks = new HashMap<Block, TempBlock>();
private final Map<Block, TempBlock> ice_blocks = new HashMap<>();
@Attribute(Attribute.HEIGHT)
private int height;
@ -62,8 +63,8 @@ public class IceSpikePillar extends IceAbility {
private ArrayList<LivingEntity> damaged;
protected boolean inField = false; // If it's part of a field or not.
public IceSpikePillar(final Player player) {
super(player);
public IceSpikePillar(final IceSpikeConfig config, final Player player) {
super(config, player);
this.setFields();
if (this.bPlayer.isOnCooldown("IceSpikePillar")) {
@ -110,8 +111,8 @@ public class IceSpikePillar extends IceAbility {
}
}
public IceSpikePillar(final Player player, final Location origin, final int damage, final Vector throwing, final long aoecooldown) {
super(player);
public IceSpikePillar(final IceSpikeConfig config, final Player player, final Location origin, final int damage, final Vector throwing, final long aoecooldown) {
super(config, player);
this.setFields();
this.cooldown = aoecooldown;
@ -132,26 +133,26 @@ public class IceSpikePillar extends IceAbility {
private void setFields() {
this.direction = new Vector(0, 1, 0);
this.speed = getConfig().getDouble("Abilities.Water.IceSpike.Speed");
this.slowCooldown = getConfig().getLong("Abilities.Water.IceSpike.SlowCooldown");
this.slowPower = getConfig().getInt("Abilities.Water.IceSpike.SlowPower");
this.slowDuration = getConfig().getInt("Abilities.Water.IceSpike.SlowDuration");
this.damage = getConfig().getDouble("Abilities.Water.IceSpike.Damage");
this.range = getConfig().getDouble("Abilities.Water.IceSpike.Range");
this.cooldown = getConfig().getLong("Abilities.Water.IceSpike.Cooldown");
this.height = getConfig().getInt("Abilities.Water.IceSpike.Height");
this.thrownForce = new Vector(0, getConfig().getDouble("Abilities.Water.IceSpike.Push"), 0);
this.speed = config.Speed;
this.slowCooldown = config.SlowCooldown;
this.slowPower = config.SlowPower;
this.slowDuration = config.SlowDuration;
this.damage = config.Damage;
this.range = config.Range;
this.cooldown = config.Cooldown;
this.height = config.Height;
this.thrownForce = new Vector(0, config.Push, 0);
this.damaged = new ArrayList<>();
this.interval = (long) (1000. / this.speed);
if (this.bPlayer.isAvatarState()) {
this.slowPower = getConfig().getInt("Abilities.Avatar.AvatarState.Water.IceSpike.SlowPower");
this.slowDuration = getConfig().getInt("Abilities.Avatar.AvatarState.Water.IceSpike.SlowDuration");
this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.IceSpike.Damage");
this.range = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.IceSpike.Range");
this.height = getConfig().getInt("Abilities.Avatar.AvatarState.Water.IceSpike.Height");
this.thrownForce = new Vector(0, getConfig().getDouble("Abilities.Avatar.AvatarState.Water.IceSpike.Push"), 0);
this.slowPower = config.AvatarState_SlowPower;
this.slowDuration = config.AvatarState_SlowDuration;
this.damage = config.AvatarState_Damage;
this.range = config.AvatarState_Range;
this.height = config.AvatarState_Height;
this.thrownForce.setY(config.AvatarState_Push);
}
}

View file

@ -18,9 +18,10 @@ import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.IceSpikeConfig;
import com.projectkorra.projectkorra.util.TempBlock;
public class IceSpikePillarField extends IceAbility {
public class IceSpikePillarField extends IceAbility<IceSpikeConfig> {
@Attribute(Attribute.DAMAGE)
private double damage;
@ -34,21 +35,21 @@ public class IceSpikePillarField extends IceAbility {
private double knockup;
private Vector thrownForce;
public IceSpikePillarField(final Player player) {
super(player);
public IceSpikePillarField(final IceSpikeConfig config, final Player player) {
super(config, player);
if (this.bPlayer.isOnCooldown("IceSpikePillarField")) {
return;
}
this.damage = getConfig().getDouble("Abilities.Water.IceSpike.Field.Damage");
this.radius = getConfig().getDouble("Abilities.Water.IceSpike.Field.Radius");
this.cooldown = getConfig().getLong("Abilities.Water.IceSpike.Field.Cooldown");
this.knockup = getConfig().getDouble("Abilities.Water.IceSpike.Field.Knockup");
this.damage = config.FieldConfig.Damage;
this.radius = config.FieldConfig.Radius;
this.cooldown = config.FieldConfig.Cooldown;
this.knockup = config.FieldConfig.Knockup;
if (this.bPlayer.isAvatarState()) {
this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.IceSpike.Field.Damage");
this.radius = getConfig().getDouble("Abilities.Avatar.AvatarState.Water.IceSpike.Field.Radius");
this.damage = config.FieldConfig.AvatarState_Damage;
this.radius = config.FieldConfig.AvatarState_Radius;
}
this.numberOfSpikes = (int) (((this.radius) * (this.radius)) / 4);
@ -118,7 +119,7 @@ public class IceSpikePillarField extends IceAbility {
}
if (targetBlock.getRelative(BlockFace.UP).getType() != Material.ICE) {
final IceSpikePillar pillar = new IceSpikePillar(this.player, targetBlock.getLocation(), (int) this.damage, this.thrownForce, this.cooldown);
final IceSpikePillar pillar = new IceSpikePillar(config, this.player, targetBlock.getLocation(), (int) this.damage, this.thrownForce, this.cooldown);
pillar.inField = true;
iceBlocks.remove(targetBlock);
} else {

View file

@ -19,6 +19,7 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.PhaseChangeConfig;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.SurgeWall;
import com.projectkorra.projectkorra.waterbending.SurgeWave;
@ -26,7 +27,8 @@ import com.projectkorra.projectkorra.waterbending.Torrent;
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArmsSpear;
public class PhaseChange extends IceAbility {
@SuppressWarnings("deprecation")
public class PhaseChange extends IceAbility<PhaseChangeConfig> {
public static enum PhaseChangeType {
FREEZE, MELT, CUSTOM;
@ -50,7 +52,7 @@ public class PhaseChange extends IceAbility {
private final Random r = new Random();
@Attribute(Attribute.SELECT_RANGE)
private int sourceRange = 8;
private double sourceRange = 8;
// Freeze Variables.
@Attribute("Freeze" + Attribute.COOLDOWN)
@ -75,8 +77,8 @@ public class PhaseChange extends IceAbility {
private boolean allowMeltFlow;
private final CopyOnWriteArrayList<Block> melted_blocks = new CopyOnWriteArrayList<>();
public PhaseChange(final Player player, final PhaseChangeType type) {
super(player);
public PhaseChange(final PhaseChangeConfig config, final Player player, final PhaseChangeType type) {
super(config, player);
this.startNewType(type);
this.start();
}
@ -158,33 +160,33 @@ public class PhaseChange extends IceAbility {
if (isNight(this.player.getWorld())) {
night = (int) Math.round(getNightFactor());
}
this.sourceRange = night * getConfig().getInt("Abilities.Water.PhaseChange.SourceRange");
this.sourceRange = night * config.SourceRange;
switch (type) {
case FREEZE:
this.depth = night * getConfig().getInt("Abilities.Water.PhaseChange.Freeze.Depth");
this.controlRadius = night * getConfig().getDouble("Abilities.Water.PhaseChange.Freeze.ControlRadius");
this.freezeCooldown = getConfig().getLong("Abilities.Water.PhaseChange.Freeze.Cooldown");
this.freezeRadius = night * getConfig().getInt("Abilities.Water.PhaseChange.Freeze.Radius");
this.depth = night * config.FreezeConfig.Depth;
this.controlRadius = night * config.FreezeConfig.ControlRadius;
this.freezeCooldown = config.FreezeConfig.Cooldown;
this.freezeRadius = night * config.FreezeConfig.Radius;
this.freezeArea(GeneralMethods.getTargetedLocation(this.player, this.sourceRange));
case MELT:
this.meltRadius = 1;
this.meltCooldown = getConfig().getLong("Abilities.Water.PhaseChange.Melt.Cooldown");
this.meltSpeed = getConfig().getDouble("Abilities.Water.PhaseChange.Melt.Speed") * night;
this.meltMaxRadius = night * getConfig().getInt("Abilities.Water.PhaseChange.Melt.Radius");
this.allowMeltFlow = getConfig().getBoolean("Abilities.Water.PhaseChange.Melt.AllowFlow");
this.meltCooldown = config.MeltConfig.Cooldown;
this.meltSpeed = config.MeltConfig.Speed * night;
this.meltMaxRadius = night * config.MeltConfig.Radius;
this.allowMeltFlow = config.MeltConfig.AllowFlow;
case CUSTOM:
this.depth = night * getConfig().getInt("Abilities.Water.PhaseChange.Freeze.Depth");
this.controlRadius = night * getConfig().getDouble("Abilities.Water.PhaseChange.Freeze.ControlRadius");
this.freezeCooldown = getConfig().getLong("Abilities.Water.PhaseChange.Freeze.Cooldown");
this.freezeRadius = night * getConfig().getInt("Abilities.Water.PhaseChange.Freeze.Radius");
this.depth = night * config.FreezeConfig.Depth;
this.controlRadius = night * config.FreezeConfig.ControlRadius;
this.freezeCooldown = config.FreezeConfig.Cooldown;
this.freezeRadius = night * config.FreezeConfig.Radius;
this.meltRadius = 1;
this.meltCooldown = getConfig().getLong("Abilities.Water.PhaseChange.Melt.Cooldown");
this.meltSpeed = getConfig().getDouble("Abilities.Water.PhaseChange.Melt.Speed") * night;
this.meltMaxRadius = night * getConfig().getInt("Abilities.Water.PhaseChange.Melt.Radius");
this.allowMeltFlow = getConfig().getBoolean("Abilities.Water.PhaseChange.Melt.AllowFlow");
this.meltCooldown = config.MeltConfig.Cooldown;
this.meltSpeed = config.MeltConfig.Speed * night;
this.meltMaxRadius = night * config.MeltConfig.Radius;
this.allowMeltFlow = config.MeltConfig.AllowFlow;
}
}
@ -532,11 +534,11 @@ public class PhaseChange extends IceAbility {
this.depth = value;
}
public int getSourceRange() {
public double getSourceRange() {
return this.sourceRange;
}
public void setSourceRange(final int value) {
public void setSourceRange(final double value) {
this.sourceRange = value;
}

View file

@ -20,7 +20,7 @@ import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.WaterArmsConfig;
import com.projectkorra.projectkorra.firebending.lightning.Lightning;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;
@ -29,7 +29,8 @@ import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArmsWhip.W
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
import com.projectkorra.projectkorra.waterbending.util.WaterReturn;
public class WaterArms extends WaterAbility {
@SuppressWarnings("deprecation")
public class WaterArms extends WaterAbility<WaterArmsConfig> {
/**
* Arm Enum value for deciding which arm is being used.
@ -53,7 +54,7 @@ public class WaterArms extends WaterAbility {
@Attribute("InitialLength")
private int initLength;
@Attribute(Attribute.SELECT_RANGE)
private int sourceGrabRange;
private double sourceGrabRange;
@Attribute("MaxPunches")
private int maxPunches;
@Attribute("MaxIceBlasts")
@ -73,23 +74,23 @@ public class WaterArms extends WaterAbility {
private List<Block> right, left;
private Set<TempBlock> external;
public WaterArms(final Player player) {
super(player);
public WaterArms(final WaterArmsConfig config, final Player player) {
super(config, player);
this.fullSource = true;
this.leftArmConsumed = false;
this.rightArmConsumed = false;
this.canUsePlantSource = getConfig().getBoolean("Abilities.Water.WaterArms.Arms.AllowPlantSource");
this.lightningEnabled = getConfig().getBoolean("Abilities.Water.WaterArms.Arms.Lightning.Enabled");
this.lightningKill = getConfig().getBoolean("Abilities.Water.WaterArms.Arms.Lightning.KillUser");
this.initLength = getConfig().getInt("Abilities.Water.WaterArms.Arms.InitialLength");
this.sourceGrabRange = getConfig().getInt("Abilities.Water.WaterArms.Arms.SourceGrabRange");
this.maxPunches = getConfig().getInt("Abilities.Water.WaterArms.Arms.MaxAttacks");
this.maxIceBlasts = getConfig().getInt("Abilities.Water.WaterArms.Arms.MaxIceShots");
this.maxUses = getConfig().getInt("Abilities.Water.WaterArms.Arms.MaxAlternateUsage");
this.cooldown = getConfig().getLong("Abilities.Water.WaterArms.Arms.Cooldown");
this.lightningDamage = getConfig().getDouble("Abilities.Water.WaterArms.Arms.Lightning.Damage");
this.sneakMsg = ConfigManager.languageConfig.get().getString("Abilities.Water.WaterArms.SneakMessage");
this.canUsePlantSource = config.AllowPlantSource;
this.lightningEnabled = config.LightningVulnerability;
this.lightningKill = config.LightningInstaKill;
this.initLength = config.InitialLength;
this.sourceGrabRange = config.SourceGrabRange;
this.maxPunches = config.MaxAttacks;
this.maxIceBlasts = config.MaxIceShots;
this.maxUses = config.MaxAlternateUsage;
this.cooldown = config.Cooldown;
this.lightningDamage = config.LightningDamage;
this.sneakMsg = config.SneakMessage;
this.lengthReduction = 0;
this.selectedSlot = 0;
this.freezeSlot = 4;
@ -109,35 +110,35 @@ public class WaterArms extends WaterAbility {
switch (player.getInventory().getHeldItemSlot()) {
case 0:
if (player.hasPermission("bending.ability.WaterArms.Pull")) {
new WaterArmsWhip(player, Whip.PULL);
new WaterArmsWhip(config, player, Whip.PULL);
}
break;
case 1:
if (player.hasPermission("bending.ability.WaterArms.Punch")) {
new WaterArmsWhip(player, Whip.PUNCH);
new WaterArmsWhip(config, player, Whip.PUNCH);
}
break;
case 2:
if (player.hasPermission("bending.ability.WaterArms.Grapple")) {
new WaterArmsWhip(player, Whip.GRAPPLE);
new WaterArmsWhip(config, player, Whip.GRAPPLE);
}
break;
case 3:
if (player.hasPermission("bending.ability.WaterArms.Grab")) {
new WaterArmsWhip(player, Whip.GRAB);
new WaterArmsWhip(config, player, Whip.GRAB);
}
break;
case 4:
if (player.hasPermission("bending.ability.WaterArms.Freeze") && this.bPlayer.canIcebend()) {
new WaterArmsFreeze(player);
new WaterArmsFreeze(config, player);
}
break;
case 5:
if (player.hasPermission("bending.ability.WaterArms.Spear")) {
if (this.bPlayer.canIcebend()) {
new WaterArmsSpear(player, true);
new WaterArmsSpear(config, player, true);
} else {
new WaterArmsSpear(player, false);
new WaterArmsSpear(config, player, false);
}
}
break;
@ -403,7 +404,7 @@ public class WaterArms extends WaterAbility {
FireAbility.playLightningbendingParticle(l1);
}
if (this.lightningKill) {
DamageHandler.damageEntity(this.player, 60D, lightning);
DamageHandler.damageEntity(this.player, this.player.getMaxHealth() * 3, lightning);
} else {
DamageHandler.damageEntity(this.player, this.lightningDamage, lightning);
}
@ -695,11 +696,11 @@ public class WaterArms extends WaterAbility {
this.initLength = initLength;
}
public int getSourceGrabRange() {
public double getSourceGrabRange() {
return this.sourceGrabRange;
}
public void setSourceGrabRange(final int sourceGrabRange) {
public void setSourceGrabRange(final double sourceGrabRange) {
this.sourceGrabRange = sourceGrabRange;
}

View file

@ -15,13 +15,14 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.WaterArmsConfig;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.util.TempPotionEffect;
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArms.Arm;
public class WaterArmsFreeze extends IceAbility {
public class WaterArmsFreeze extends IceAbility<WaterArmsConfig> {
private boolean cancelled;
private boolean usageCooldownEnabled;
@ -37,13 +38,13 @@ public class WaterArmsFreeze extends IceAbility {
private Vector direction;
private WaterArms waterArms;
public WaterArmsFreeze(final Player player) {
super(player);
public WaterArmsFreeze(final WaterArmsConfig config, final Player player) {
super(config, player);
this.usageCooldownEnabled = getConfig().getBoolean("Abilities.Water.WaterArms.Arms.Cooldowns.UsageCooldown.Enabled");
this.iceRange = getConfig().getInt("Abilities.Water.WaterArms.Freeze.Range");
this.iceDamage = getConfig().getInt("Abilities.Water.WaterArms.Freeze.Damage");
this.usageCooldown = getConfig().getLong("Abilities.Water.WaterArms.Arms.Cooldowns.UsageCooldown.Freeze");
this.usageCooldownEnabled = config.FreezeConfig.UsageCooldownEnabled;
this.iceRange = config.FreezeConfig.Range;
this.iceDamage = config.FreezeConfig.Damage;
this.usageCooldown = config.FreezeConfig.UsageCooldown;
this.direction = player.getEyeLocation().getDirection();
this.createInstance();

View file

@ -19,11 +19,15 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.WaterAbility;
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.water.WaterArmsConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.WaterPropertiesConfig;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArms.Arm;
public class WaterArmsSpear extends WaterAbility {
@SuppressWarnings({ "deprecation", "unused" })
public class WaterArmsSpear extends WaterAbility<WaterArmsConfig> {
private static final Map<Block, Long> ICE_BLOCKS = new ConcurrentHashMap<Block, Long>();
@ -57,24 +61,24 @@ public class WaterArmsSpear extends WaterAbility {
private WaterArms waterArms;
private final List<Location> spearLocations;
public WaterArmsSpear(final Player player, final boolean freeze) {
super(player);
public WaterArmsSpear(final WaterArmsConfig config, final Player player, final boolean freeze) {
super(config, player);
this.canFreeze = freeze;
this.usageCooldownEnabled = getConfig().getBoolean("Abilities.Water.WaterArms.Arms.Cooldowns.UsageCooldown.Enabled");
this.spearDamageEnabled = getConfig().getBoolean("Abilities.Water.WaterArms.Spear.DamageEnabled");
this.spearLength = getConfig().getInt("Abilities.Water.WaterArms.Spear.Length");
this.spearRange = getConfig().getInt("Abilities.Water.WaterArms.Spear.Range");
this.spearRangeNight = getConfig().getInt("Abilities.Water.WaterArms.Spear.NightAugments.Range.Normal");
this.spearRangeFullMoon = getConfig().getInt("Abilities.Water.WaterArms.Spear.NightAugments.Range.FullMoon");
this.spearSphereRadius = getConfig().getInt("Abilities.Water.WaterArms.Spear.SphereRadius");
this.spearSphereNight = getConfig().getInt("Abilities.Water.WaterArms.Spear.NightAugments.Sphere.Normal");
this.spearSphereFullMoon = getConfig().getInt("Abilities.Water.WaterArms.Spear.NightAugments.Sphere.FullMoon");
this.spearDuration = getConfig().getLong("Abilities.Water.WaterArms.Spear.Duration");
this.spearDurationNight = getConfig().getLong("Abilities.Water.WaterArms.Spear.NightAugments.Duration.Normal");
this.spearDurationFullMoon = getConfig().getLong("Abilities.Water.WaterArms.Spear.NightAugments.Duration.FullMoon");
this.usageCooldown = getConfig().getLong("Abilities.Water.WaterArms.Arms.Cooldowns.UsageCooldown.Spear");
this.spearDamage = getConfig().getDouble("Abilities.Water.WaterArms.Spear.Damage");
this.usageCooldownEnabled = config.SpearConfig.UsageCooldownEnabled;
this.spearDamageEnabled = config.SpearConfig.DamageEnabled;
this.spearLength = config.SpearConfig.Length;
this.spearRange = config.SpearConfig.RangeDay;
this.spearRangeNight = config.SpearConfig.RangeNight;
this.spearRangeFullMoon = config.SpearConfig.RangeFullMoon;
this.spearSphereRadius = config.SpearConfig.SphereRadiusDay;
this.spearSphereNight = config.SpearConfig.SphereRadiusNight;
this.spearSphereFullMoon = config.SpearConfig.SphereRadiusFullMoon;
this.spearDuration = config.SpearConfig.DurationDay;
this.spearDurationNight = config.SpearConfig.DurationNight;
this.spearDurationFullMoon = config.SpearConfig.DurationFullMoon;
this.usageCooldown = config.SpearConfig.UsageCooldown;
this.spearDamage = config.SpearConfig.Damage;
this.spearLocations = new ArrayList<>();
this.getNightAugments();
@ -238,10 +242,10 @@ public class WaterArmsSpear extends WaterAbility {
if (Commands.invincible.contains(((Player) entity).getName())) {
return;
}
if (!getConfig().getBoolean("Properties.Water.FreezePlayerHead") && GeneralMethods.playerHeadIsInBlock((Player) entity, block, true)) {
if (!ConfigManager.getConfig(WaterPropertiesConfig.class).FreezePlayerHead && GeneralMethods.playerHeadIsInBlock((Player) entity, block, true)) {
continue ICE_SETTING;
}
if (!getConfig().getBoolean("Properties.Water.FreezePlayerFeet") && GeneralMethods.playerFeetIsInBlock((Player) entity, block, true)) {
if (!ConfigManager.getConfig(WaterPropertiesConfig.class).FreezePlayerFeet && GeneralMethods.playerFeetIsInBlock((Player) entity, block, true)) {
continue ICE_SETTING;
}
}

View file

@ -17,11 +17,12 @@ import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.WaterArmsConfig;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArms.Arm;
public class WaterArmsWhip extends WaterAbility {
public class WaterArmsWhip extends WaterAbility<WaterArmsConfig> {
/**
* Whip Enum value for deciding what ability should be executed.
@ -67,42 +68,42 @@ public class WaterArmsWhip extends WaterAbility {
private Location end;
private WaterArms waterArms;
public WaterArmsWhip(final Player player, final Whip ability) {
super(player);
public WaterArmsWhip(final WaterArmsConfig config, final Player player, final Whip ability) {
super(config, player);
this.ability = ability;
this.reverting = false;
this.hasDamaged = false;
this.grappled = false;
this.grabbed = false;
this.grappleRespectRegions = getConfig().getBoolean("Abilities.Water.WaterArms.Whip.Grapple.RespectRegions");
this.usageCooldownEnabled = getConfig().getBoolean("Abilities.Water.WaterArms.Arms.Cooldowns.UsageCooldown.Enabled");
this.whipLength = getConfig().getInt("Abilities.Water.WaterArms.Whip.MaxLength");
this.whipLengthWeak = getConfig().getInt("Abilities.Water.WaterArms.Whip.MaxLengthWeak");
this.whipLengthNight = getConfig().getInt("Abilities.Water.WaterArms.Whip.NightAugments.MaxLength.Normal");
this.whipLengthFullMoon = getConfig().getInt("Abilities.Water.WaterArms.Whip.NightAugments.MaxLength.FullMoon");
this.initLength = getConfig().getInt("Abilities.Water.WaterArms.Arms.InitialLength");
this.punchLength = getConfig().getInt("Abilities.Water.WaterArms.Whip.Punch.MaxLength");
this.punchLengthNight = getConfig().getInt("Abilities.Water.WaterArms.Whip.Punch.NightAugments.MaxLength.Normal");
this.punchLengthFullMoon = getConfig().getInt("Abilities.Water.WaterArms.Whip.Punch.NightAugments.MaxLength.FullMoon");
this.grappleRespectRegions = config.WhipConfig.GrappleRespectRegions;
this.usageCooldownEnabled = config.WhipConfig.UsageCooldownEnabled;
this.whipLength = config.WhipConfig.MaxLengthDay;
this.whipLengthWeak = config.WhipConfig.MaxLengthWeak;
this.whipLengthNight = config.WhipConfig.MaxLengthNight;
this.whipLengthFullMoon = config.WhipConfig.MaxLengthFullMoon;
this.initLength = config.InitialLength;
this.punchLength = config.WhipConfig.PunchLengthDay;
this.punchLengthNight = config.WhipConfig.PunchLengthNight;
this.punchLengthFullMoon = config.WhipConfig.PunchLengthFullMoon;
this.activeLength = this.initLength;
this.whipSpeed = 1;
this.grabDuration = getConfig().getLong("Abilities.Water.WaterArms.Whip.Grab.Duration");
this.pullMultiplier = getConfig().getDouble("Abilities.Water.WaterArms.Whip.Pull.Multiplier");
this.punchDamage = getConfig().getDouble("Abilities.Water.WaterArms.Whip.Punch.Damage");
this.grabDuration = config.WhipConfig.GrabDuration;
this.pullMultiplier = config.WhipConfig.PullFactor;
this.punchDamage = config.WhipConfig.PunchDamage;
switch (ability) {
case PULL:
this.usageCooldown = getConfig().getLong("Abilities.Water.WaterArms.Arms.Cooldowns.UsageCooldown.Pull");
this.usageCooldown = config.WhipConfig.UsageCooldownPull;
break;
case PUNCH:
this.usageCooldown = getConfig().getLong("Abilities.Water.WaterArms.Arms.Cooldowns.UsageCooldown.Punch");
this.usageCooldown = config.WhipConfig.UsageCooldownPunch;
break;
case GRAPPLE:
this.usageCooldown = getConfig().getLong("Abilities.Water.WaterArms.Arms.Cooldowns.UsageCooldown.Grapple");
this.usageCooldown = config.WhipConfig.UsageCooldownGrapple;
break;
case GRAB:
this.usageCooldown = getConfig().getLong("Abilities.Water.WaterArms.Arms.Cooldowns.UsageCooldown.Grab");
this.usageCooldown = config.WhipConfig.UsageCooldownGrab;
break;
default:
this.usageCooldown = 200;

View file

@ -6,19 +6,20 @@ import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.PassiveAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.water.FastSwimConfig;
import com.projectkorra.projectkorra.earthbending.EarthArmor;
import com.projectkorra.projectkorra.waterbending.WaterSpout;
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArms;
public class FastSwim extends WaterAbility implements PassiveAbility {
public class FastSwim extends WaterAbility<FastSwimConfig> implements PassiveAbility {
private long cooldown;
private double swimSpeed;
private long duration;
public FastSwim(final Player player) {
super(player);
public FastSwim(final FastSwimConfig config, final Player player) {
super(config, player);
if (this.bPlayer.isOnCooldown(this)) {
return;
}
@ -27,9 +28,9 @@ public class FastSwim extends WaterAbility implements PassiveAbility {
return;
}
this.cooldown = ConfigManager.getConfig().getLong("Abilities.Water.Passive.FastSwim.Cooldown");
this.swimSpeed = ConfigManager.getConfig().getDouble("Abilities.Water.Passive.FastSwim.SpeedFactor");
this.duration = ConfigManager.getConfig().getLong("Abilities.Water.Passive.FastSwim.Duration");
this.cooldown = config.Cooldown;
this.swimSpeed = config.SpeedFactor;
this.duration = config.Duration;
this.start();
}
@ -60,7 +61,7 @@ public class FastSwim extends WaterAbility implements PassiveAbility {
}
public static double getSwimSpeed() {
return ConfigManager.getConfig().getDouble("Abilities.Water.Passive.FastSwim.SpeedFactor");
return ConfigManager.getConfig(FastSwimConfig.class).SpeedFactor;
}
@Override

View file

@ -10,16 +10,18 @@ import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.PassiveAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
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.water.HydroSinkConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.GeneralPropertiesConfig;
import com.projectkorra.projectkorra.util.TempBlock;
public class HydroSink extends WaterAbility implements PassiveAbility {
public HydroSink(final Player player) {
super(player);
public class HydroSink extends WaterAbility<HydroSinkConfig> implements PassiveAbility {
public HydroSink(final HydroSinkConfig config, final Player player) {
super(config, player);
}
public static boolean applyNoFall(final Player player) {
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
if (Commands.isToggledForAll && ConfigManager.getConfig(GeneralPropertiesConfig.class).TogglePassivesWithAllBending) {
return false;
}

View file

@ -10,8 +10,11 @@ import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.PlantAbility;
import com.projectkorra.projectkorra.configuration.better.ConfigManager;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.EmptyAbilityConfig;
import com.projectkorra.projectkorra.configuration.better.configs.properties.WaterPropertiesConfig;
public class PlantRegrowth extends PlantAbility {
public class PlantRegrowth extends PlantAbility<EmptyAbilityConfig> {
private BlockData data;
private long time;
@ -20,9 +23,9 @@ public class PlantRegrowth extends PlantAbility {
private Block block;
public PlantRegrowth(final Player player, final Block block) {
super(player);
super(new EmptyAbilityConfig(), player);
this.regrowTime = getConfig().getLong("Abilities.Water.Plantbending.RegrowTime");
this.regrowTime = ConfigManager.getConfig(WaterPropertiesConfig.class).PlantRegrowTime;
if (this.regrowTime != 0) {
this.block = block;
this.type = block.getType();

View file

@ -15,6 +15,7 @@ import org.bukkit.util.Vector;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.configuration.better.configs.abilities.EmptyAbilityConfig;
import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.OctopusForm;
@ -22,7 +23,8 @@ import com.projectkorra.projectkorra.waterbending.SurgeWall;
import com.projectkorra.projectkorra.waterbending.WaterManipulation;
import com.projectkorra.projectkorra.waterbending.ice.IceSpikeBlast;
public class WaterReturn extends WaterAbility {
@SuppressWarnings("deprecation")
public class WaterReturn extends WaterAbility<EmptyAbilityConfig> {
private long time;
private long interval;
@ -31,7 +33,7 @@ public class WaterReturn extends WaterAbility {
private TempBlock block;
public WaterReturn(final Player player, final Block block) {
super(player);
super(new EmptyAbilityConfig(), player);
if (hasAbility(player, WaterReturn.class)) {
return;
}

View file

@ -17,6 +17,7 @@ import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.util.TempBlock;
@SuppressWarnings("deprecation")
public class WaterSourceGrabber {
/*