diff --git a/src/com/projectkorra/projectkorra/ability/WaterAbility.java b/src/com/projectkorra/projectkorra/ability/WaterAbility.java index e0006b45..62f4c712 100644 --- a/src/com/projectkorra/projectkorra/ability/WaterAbility.java +++ b/src/com/projectkorra/projectkorra/ability/WaterAbility.java @@ -290,7 +290,6 @@ public abstract class WaterAbility extends ElementalAbility { public static void stopBending() { PhaseChangeFreeze.removeAllCleanup(); - WaterSpout.removeAllCleanup(); SurgeWall.removeAllCleanup(); SurgeWave.removeAllCleanup(); WaterArms.removeAllCleanup(); diff --git a/src/com/projectkorra/projectkorra/airbending/AirCombo.java b/src/com/projectkorra/projectkorra/airbending/AirCombo.java index 27fd7668..9d2e50a1 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirCombo.java +++ b/src/com/projectkorra/projectkorra/airbending/AirCombo.java @@ -74,6 +74,7 @@ public class AirCombo extends AirAbility implements ComboAbility { this.speed = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Speed"); this.cooldown = getConfig().getLong("Abilities.Air.AirCombo.Twister.Cooldown"); this.twisterHeight = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Height"); + this.twisterRadius = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Radius"); this.twisterDegreeParticles = getConfig().getDouble("Abilities.Air.AirCombo.Twister.DegreesPerParticle"); this.twisterHeightParticles = getConfig().getDouble("Abilities.Air.AirCombo.Twister.HeightPerParticle"); this.twisterRemoveDelay = getConfig().getLong("Abilities.Air.AirCombo.Twister.RemoveDelay"); diff --git a/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java b/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java index 9df30db0..818f42e7 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java +++ b/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java @@ -20,17 +20,21 @@ public class AcrobatStance extends ChiAbility { return; } - this.speed = getConfig().getInt("Abilities.Chi.AcrobatStance.Speed"); - this.jump = getConfig().getInt("Abilities.Chi.AcrobatStance.Jump"); + this.speed = getConfig().getInt("Abilities.Chi.AcrobatStance.Speed") + 1; + this.jump = getConfig().getInt("Abilities.Chi.AcrobatStance.Jump") + 1; this.chiBlockBoost = getConfig().getDouble("Abilities.Chi.AcrobatStance.ChiBlockBoost"); this.paralyzeDodgeBoost = getConfig().getDouble("Abilities.Chi.AcrobatStance.ParalyzeChanceDecrease"); ChiAbility stance = bPlayer.getStance(); - if (stance != null && !(stance instanceof AcrobatStance)) { + if (stance != null) { stance.remove(); - bPlayer.setStance(this); + if (stance instanceof AcrobatStance) { + bPlayer.setStance(null); + return; + } } start(); + bPlayer.setStance(this); } @Override @@ -41,10 +45,10 @@ public class AcrobatStance extends ChiAbility { } if (!player.hasPotionEffect(PotionEffectType.SPEED)) { - player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, speed)); + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, speed, true)); } if (!player.hasPotionEffect(PotionEffectType.JUMP)) { - player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jump)); + player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jump, true)); } } diff --git a/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java b/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java index 828a31f0..66ba4d79 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java +++ b/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java @@ -17,15 +17,19 @@ public class WarriorStance extends ChiAbility { if (!bPlayer.canBend(this)) { return; } - this.strength = getConfig().getInt("Abilities.Chi.WarriorStance.Strength"); + this.strength = getConfig().getInt("Abilities.Chi.WarriorStance.Strength") - 1; this.resistance = getConfig().getInt("Abilities.Chi.WarriorStance.Resistance"); ChiAbility stance = bPlayer.getStance(); - if (stance != null && !(stance instanceof WarriorStance)) { + if (stance != null) { stance.remove(); - bPlayer.setStance(this); + if (stance instanceof WarriorStance) { + bPlayer.setStance(null); + return; + } } start(); + bPlayer.setStance(this); } @Override @@ -36,10 +40,10 @@ public class WarriorStance extends ChiAbility { } if (!player.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) { - player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 60, resistance)); + player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 60, resistance, true)); } if (!player.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) { - player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 60, strength)); + player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 60, strength, true)); } } diff --git a/src/com/projectkorra/projectkorra/command/Commands.java b/src/com/projectkorra/projectkorra/command/Commands.java index 47eca6a8..833e45aa 100644 --- a/src/com/projectkorra/projectkorra/command/Commands.java +++ b/src/com/projectkorra/projectkorra/command/Commands.java @@ -74,7 +74,7 @@ public class Commands { public static String[] lightningaliases = { "lightningbending", "lightning" }; //Miscellaneous - public static String[] commandaliases = { "b", "pk", "bending", "mtla", "tla", "korra", "bend" }; + public static String[] commandaliases = { "b", "pk", "projectkorra", "bending", "mtla", "tla", "korra", "bend" }; private void init() { PluginCommand projectkorra = plugin.getCommand("projectkorra"); diff --git a/src/com/projectkorra/projectkorra/waterbending/IceSpikeBlast.java b/src/com/projectkorra/projectkorra/waterbending/IceSpikeBlast.java index d1e29e47..8f9d3c30 100644 --- a/src/com/projectkorra/projectkorra/waterbending/IceSpikeBlast.java +++ b/src/com/projectkorra/projectkorra/waterbending/IceSpikeBlast.java @@ -42,6 +42,7 @@ public class IceSpikeBlast extends IceAbility { private Location firstDestination; private Location destination; private TempBlock source; + private TempBlock originalSource; public IceSpikeBlast(Player player) { super(player); @@ -214,6 +215,7 @@ public class IceSpikeBlast extends IceAbility { } progressing = false; } + originalSource.revertBlock(); bPlayer.addCooldown("IceSpikeBlast", cooldown); } @@ -255,7 +257,7 @@ public class IceSpikeBlast extends IceAbility { sourceBlock.setType(Material.AIR); } - new TempBlock(sourceBlock, Material.AIR, data); + originalSource = new TempBlock(sourceBlock, Material.AIR, data); } public static void activate(Player player) { diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterArmsWhip.java b/src/com/projectkorra/projectkorra/waterbending/WaterArmsWhip.java index 92c431c4..d09d70fe 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterArmsWhip.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterArmsWhip.java @@ -339,6 +339,14 @@ public class WaterArmsWhip extends WaterAbility { GRABBED_ENTITIES.remove(grabbedEntity); return; } + if (grabbedEntity instanceof Player && hasAbility((Player) grabbedEntity, WaterArmsWhip.class)) { + WaterArmsWhip waw = getAbility((Player) grabbedEntity, WaterArmsWhip.class); + if (waw.getAbility().equals(Whip.GRAB)) { + grabbed = false; + GRABBED_ENTITIES.remove(grabbedEntity); + return; + } + } Location newLocation = grabbedEntity.getLocation(); double distance = location.distance(newLocation); diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterSpout.java b/src/com/projectkorra/projectkorra/waterbending/WaterSpout.java index 03954bbf..5f18c5a8 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterSpout.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterSpout.java @@ -13,14 +13,15 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffectType; +import java.util.ArrayList; +import java.util.List; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; public class WaterSpout extends WaterAbility { private static final ConcurrentHashMap AFFECTED_BLOCKS = new ConcurrentHashMap(); - private static final ConcurrentHashMap NEW_AFFECTED_BLOCKS = new ConcurrentHashMap(); - private static final ConcurrentHashMap REVERT_BLOCKS = new ConcurrentHashMap(); + private List blocks = new ArrayList(); private boolean canBendOnPackedIce; private boolean useParticles; @@ -90,18 +91,23 @@ public class WaterSpout extends WaterAbility { Block block = loc.getBlock(); if (block.getType().equals(Material.AIR) || !GeneralMethods.isSolid(block)) { - REVERT_BLOCKS.put(block, 0L); - new TempBlock(block, Material.STATIONARY_WATER, (byte) 1); + blocks.add(new TempBlock(block, Material.STATIONARY_WATER, (byte) 1)); + AFFECTED_BLOCKS.put(block, block); } } } @Override public void progress() { + for (TempBlock tb : blocks) { + AFFECTED_BLOCKS.remove(tb.getBlock()); + tb.revertBlock(); + } if (player.isDead() || !player.isOnline() || !bPlayer.canBind(this)) { remove(); return; } else { + blocks.clear(); player.setFallDistance(0); player.setSprinting(false); if ((new Random()).nextInt(4) == 0) { @@ -119,13 +125,10 @@ public class WaterSpout extends WaterAbility { block = location.clone().add(0, i, 0).getBlock(); if (!TempBlock.isTempBlock(block)) { - new TempBlock(block, Material.STATIONARY_WATER, (byte) 8); - } - if (!AFFECTED_BLOCKS.containsKey(block)) { + blocks.add(new TempBlock(block, Material.STATIONARY_WATER, (byte) 8)); AFFECTED_BLOCKS.put(block, block); } rotateParticles(block); - NEW_AFFECTED_BLOCKS.put(block, block); } displayWaterSpiral(location.clone().add(.5, 0, .5)); @@ -147,6 +150,10 @@ public class WaterSpout extends WaterAbility { public void remove() { super.remove(); revertBaseBlock(); + for (TempBlock tb : blocks) { + AFFECTED_BLOCKS.remove(tb.getBlock()); + tb.revertBlock(); + } } public void revertBaseBlock() { @@ -206,7 +213,7 @@ public class WaterSpout extends WaterAbility { return -1; } - if (!AFFECTED_BLOCKS.contains(blocki)) { + if (!blocks.contains(blocki)) { if (isWater(blocki)) { if (!TempBlock.isTempBlock(blocki)) { revertBaseBlock(); @@ -241,40 +248,6 @@ public class WaterSpout extends WaterAbility { return -1; } - public static void progressAllCleanup() { - NEW_AFFECTED_BLOCKS.clear(); - revertAllBlocks(false); - - for (Block block : AFFECTED_BLOCKS.keySet()) { - if (!NEW_AFFECTED_BLOCKS.containsKey(block)) { - AFFECTED_BLOCKS.remove(block); - TempBlock.revertBlock(block, Material.AIR); - } - } - } - - private static void revertAllBlocks(boolean ignoreTime) { - for (Block block : REVERT_BLOCKS.keySet()) { - long time = REVERT_BLOCKS.get(block); - if (System.currentTimeMillis() > time || ignoreTime) { - if (TempBlock.isTempBlock(block)) { - TempBlock.revertBlock(block, Material.AIR); - } - REVERT_BLOCKS.remove(block); - } - } - } - - public static void removeAllCleanup() { - revertAllBlocks(true); - REVERT_BLOCKS.clear(); - - for (Block block : AFFECTED_BLOCKS.keySet()) { - TempBlock.revertBlock(block, Material.AIR); - AFFECTED_BLOCKS.remove(block); - } - } - public static boolean removeSpouts(Location loc0, double radius, Player sourcePlayer) { boolean removed = false; Location loc1 = sourcePlayer.getLocation().getBlock().getLocation(); @@ -402,12 +375,4 @@ public class WaterSpout extends WaterAbility { return AFFECTED_BLOCKS; } - public static ConcurrentHashMap getNewAffectedBlocks() { - return NEW_AFFECTED_BLOCKS; - } - - public static ConcurrentHashMap getRevertBlocks() { - return REVERT_BLOCKS; - } - } \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterbendingManager.java b/src/com/projectkorra/projectkorra/waterbending/WaterbendingManager.java index 3c6d12d1..9707ee88 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterbendingManager.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterbendingManager.java @@ -15,7 +15,6 @@ public class WaterbendingManager implements Runnable { WaterPassive.handlePassive(); PhaseChangeFreeze.handleFrozenBlocks(); HealingWaters.heal(); - WaterSpout.progressAllCleanup(); Torrent.progressAllCleanup(); WaterArms.progressAllCleanup(); }