From ba05e47118eb29da415a4bc863221b2c6ca7f3db Mon Sep 17 00:00:00 2001 From: Loony Date: Sat, 23 Jul 2016 02:30:23 +0100 Subject: [PATCH] Fixes plant source issues & chat colour for clearing a slot (#519) * Fixes plant regrowth for WaterArms & WaterSpoutWave * Fixed chat colour for clearing a slot * Fixed moves not removing spouts --- .../projectkorra/ability/EarthAbility.java | 10 +++++++++- .../projectkorra/projectkorra/airbending/AirCombo.java | 6 +++++- .../projectkorra/projectkorra/airbending/AirSwipe.java | 4 ++++ .../projectkorra/command/ClearCommand.java | 2 +- .../projectkorra/earthbending/EarthBlast.java | 2 ++ .../projectkorra/earthbending/EarthSmash.java | 1 + .../projectkorra/firebending/FireBlast.java | 2 ++ .../projectkorra/firebending/FireCombo.java | 7 +++++-- .../projectkorra/waterbending/WaterArms.java | 3 +++ .../projectkorra/waterbending/WaterManipulation.java | 2 ++ .../projectkorra/waterbending/WaterSpoutWave.java | 1 + 11 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/com/projectkorra/projectkorra/ability/EarthAbility.java b/src/com/projectkorra/projectkorra/ability/EarthAbility.java index 1bed9949..6fb19346 100644 --- a/src/com/projectkorra/projectkorra/ability/EarthAbility.java +++ b/src/com/projectkorra/projectkorra/ability/EarthAbility.java @@ -25,6 +25,7 @@ import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.earthbending.EarthPassive; import com.projectkorra.projectkorra.earthbending.LavaFlow; import com.projectkorra.projectkorra.earthbending.RaiseEarth; +import com.projectkorra.projectkorra.earthbending.SandSpout; import com.projectkorra.projectkorra.util.BlockSource; import com.projectkorra.projectkorra.util.Information; import com.projectkorra.projectkorra.util.ParticleEffect; @@ -610,7 +611,7 @@ public abstract class EarthAbility extends ElementalAbility { MOVED_EARTH.remove(block); } return true; - } + } public static void stopBending() { EarthPassive.removeAll(); @@ -619,4 +620,11 @@ public abstract class EarthAbility extends ElementalAbility { removeAllEarthbendedBlocks(); } } + + public static void removeSandSpouts(Location loc, double radius, Player source) { + SandSpout.removeSpouts(loc, radius, source); + } + public static void removeSandSpouts(Location loc, Player source) { + removeSandSpouts(loc, 1.5, source); + } } diff --git a/src/com/projectkorra/projectkorra/airbending/AirCombo.java b/src/com/projectkorra/projectkorra/airbending/AirCombo.java index d38d6189..8439a655 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirCombo.java +++ b/src/com/projectkorra/projectkorra/airbending/AirCombo.java @@ -4,7 +4,9 @@ import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.ComboAbility; +import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.WaterAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.command.Commands; @@ -347,7 +349,9 @@ public class AirCombo extends AirAbility implements ComboAbility { if (GeneralMethods.blockAbilities(player, FireCombo.getBlockableAbilities(), loc, 1)) { fstream.remove(); - } + } else AirAbility.removeAirSpouts(loc, player); + WaterAbility.removeWaterSpouts(loc, player); + EarthAbility.removeSandSpouts(loc, player); } } } diff --git a/src/com/projectkorra/projectkorra/airbending/AirSwipe.java b/src/com/projectkorra/projectkorra/airbending/AirSwipe.java index d21c86b7..6369beca 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirSwipe.java +++ b/src/com/projectkorra/projectkorra/airbending/AirSwipe.java @@ -3,6 +3,7 @@ package com.projectkorra.projectkorra.airbending; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.WaterAbility; import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.command.Commands; @@ -126,6 +127,8 @@ public class AirSwipe extends AirAbility { } else { removeAirSpouts(location, player); WaterAbility.removeWaterSpouts(location, player); + EarthAbility.removeSandSpouts(location, player); + if (EarthBlast.annihilateBlasts(location, radius, player) || WaterManipulation.annihilateBlasts(location, radius, player) @@ -178,6 +181,7 @@ public class AirSwipe extends AirAbility { private void affectPeople(Location location, Vector direction) { WaterAbility.removeWaterSpouts(location, player); removeAirSpouts(location, player); + removeAirSpouts(location, player); final List entities = GeneralMethods.getEntitiesAroundPoint(location, radius); final Vector fDirection = direction; diff --git a/src/com/projectkorra/projectkorra/command/ClearCommand.java b/src/com/projectkorra/projectkorra/command/ClearCommand.java index 40221e54..34f26263 100644 --- a/src/com/projectkorra/projectkorra/command/ClearCommand.java +++ b/src/com/projectkorra/projectkorra/command/ClearCommand.java @@ -63,7 +63,7 @@ public class ClearCommand extends PKCommand { if (bPlayer.getAbilities().get(slot) != null) { bPlayer.getAbilities().remove(slot); GeneralMethods.saveAbility(bPlayer, slot, null); - sender.sendMessage(clearedSlot.replace("{slot}", String.valueOf(slot))); + sender.sendMessage(ChatColor.YELLOW + clearedSlot.replace("{slot}", String.valueOf(slot))); } else { sender.sendMessage(ChatColor.YELLOW + alreadyEmpty); } diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java b/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java index 0dcdbe17..fedcec76 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java @@ -218,6 +218,7 @@ public class EarthBlast extends EarthAbility { WaterAbility.removeWaterSpouts(location, player); AirAbility.removeAirSpouts(location, player); + EarthAbility.removeSandSpouts(location, player); if (block.getLocation().equals(sourceBlock.getLocation())) { location = location.clone().add(direction); @@ -236,6 +237,7 @@ public class EarthBlast extends EarthAbility { WaterAbility.removeWaterSpouts(location, player); AirAbility.removeAirSpouts(location, player); + EarthAbility.removeSandSpouts(location, player); if (EarthBlast.annihilateBlasts(location, collisionRadius, player) || WaterManipulation.annihilateBlasts(location, collisionRadius, player) diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java b/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java index ef0454c2..f7a472e8 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java @@ -210,6 +210,7 @@ public class EarthSmash extends EarthAbility { WaterAbility.removeWaterSpouts(location, 2, player); AirAbility.removeAirSpouts(location, 2, player); + EarthAbility.removeSandSpouts(location, player); draw(); return; } else { diff --git a/src/com/projectkorra/projectkorra/firebending/FireBlast.java b/src/com/projectkorra/projectkorra/firebending/FireBlast.java index ac072b02..b5237e1c 100644 --- a/src/com/projectkorra/projectkorra/firebending/FireBlast.java +++ b/src/com/projectkorra/projectkorra/firebending/FireBlast.java @@ -3,6 +3,7 @@ package com.projectkorra.projectkorra.firebending; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.FireAbility; import com.projectkorra.projectkorra.ability.WaterAbility; import com.projectkorra.projectkorra.avatar.AvatarState; @@ -193,6 +194,7 @@ public class FireBlast extends FireAbility { WaterAbility.removeWaterSpouts(location, player); AirAbility.removeAirSpouts(location, player); + EarthAbility.removeSandSpouts(location, player); Player source = player; if (EarthBlast.annihilateBlasts(location, collisionRadius, source) diff --git a/src/com/projectkorra/projectkorra/firebending/FireCombo.java b/src/com/projectkorra/projectkorra/firebending/FireCombo.java index a93dd233..043ae305 100644 --- a/src/com/projectkorra/projectkorra/firebending/FireCombo.java +++ b/src/com/projectkorra/projectkorra/firebending/FireCombo.java @@ -18,6 +18,7 @@ import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.ComboAbility; +import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.ElementalAbility; import com.projectkorra.projectkorra.ability.FireAbility; import com.projectkorra.projectkorra.ability.WaterAbility; @@ -264,12 +265,14 @@ public class FireCombo extends FireAbility implements ComboAbility { for (FireComboStream stream : tasks) { if (GeneralMethods.blockAbilities(player, BLOCKABLE_ABILITIES, stream.location, 2)) { stream.remove(); - } + } } } else if (tasks.size() == 0) { remove(); return; - } + } AirAbility.removeAirSpouts(location, player); + WaterAbility.removeWaterSpouts(location, player); + EarthAbility.removeSandSpouts(location, player); } else if (ability.equalsIgnoreCase("FireSpin")) { if (destination == null) { if (bPlayer.isOnCooldown("FireSpin") && !bPlayer.isAvatarState()) { diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterArms.java b/src/com/projectkorra/projectkorra/waterbending/WaterArms.java index 1fb2b805..2bcc745c 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterArms.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterArms.java @@ -12,6 +12,7 @@ import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.waterbending.WaterArmsWhip.Whip; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; @@ -151,6 +152,8 @@ public class WaterArms extends WaterAbility { fullSource = false; } ParticleEffect.LARGE_SMOKE.display(getWaterSourceBlock(player, sourceGrabRange, canUsePlantSource).getLocation().clone().add(0.5, 0.5, 0.5), 0, 0, 0, 0F, 4); + new PlantRegrowth(player, sourceBlock); + sourceBlock.setType(Material.AIR); return true; } else if (WaterReturn.hasWaterBottle(player)) { WaterReturn.emptyWaterBottle(player); diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java b/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java index 450f5254..48c60daa 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java @@ -18,6 +18,7 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.WaterAbility; import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.earthbending.EarthBlast; @@ -231,6 +232,7 @@ public class WaterManipulation extends WaterAbility { } else { WaterAbility.removeWaterSpouts(location, player); AirAbility.removeAirSpouts(location, player); + EarthAbility.removeSandSpouts(location, player); if ((new Random()).nextInt(4) == 0) { playWaterbendingSound(location); diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java b/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java index fab68a59..ef161129 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java @@ -176,6 +176,7 @@ public class WaterSpoutWave extends WaterAbility { if (isPlant(origin.getBlock())) { new PlantRegrowth(player, origin.getBlock()); + origin.getBlock().setType(Material.AIR); } }