From a30b4918b405e9a8672cc00d8c755a5303c9d8d3 Mon Sep 17 00:00:00 2001 From: StrangeOne101 Date: Wed, 24 Aug 2016 07:54:58 +1200 Subject: [PATCH] Fixed Toggling Passives & Underwater Select Range (#556) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Fixed Passives not being toggled with bending when they should be • Fixed the select range for water moves being in your face when you're under water (again) --- src/com/projectkorra/projectkorra/BendingPlayer.java | 4 ++++ .../projectkorra/projectkorra/ability/WaterAbility.java | 4 ++-- .../projectkorra/earthbending/EarthPassive.java | 5 +++++ .../projectkorra/firebending/FirePassive.java | 5 +++++ .../projectkorra/waterbending/WaterPassive.java | 8 ++++++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/com/projectkorra/projectkorra/BendingPlayer.java b/src/com/projectkorra/projectkorra/BendingPlayer.java index 7076695a..30721042 100644 --- a/src/com/projectkorra/projectkorra/BendingPlayer.java +++ b/src/com/projectkorra/projectkorra/BendingPlayer.java @@ -232,6 +232,10 @@ public class BendingPlayer { } public boolean canBendPassive(Element element) { + if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) { + return false; + } + List disabledWorlds = getConfig().getStringList("Properties.DisabledWorlds"); if (element == null || player == null) { diff --git a/src/com/projectkorra/projectkorra/ability/WaterAbility.java b/src/com/projectkorra/projectkorra/ability/WaterAbility.java index e7cd0d7e..c0d74ed0 100644 --- a/src/com/projectkorra/projectkorra/ability/WaterAbility.java +++ b/src/com/projectkorra/projectkorra/ability/WaterAbility.java @@ -190,10 +190,10 @@ public abstract class WaterAbility extends ElementalAbility { Vector vector = location.getDirection().clone().normalize(); BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); - Block testBlock = player.getTargetBlock(getTransparentMaterialSet(), (int) range); + Block testBlock = player.getTargetBlock(getTransparentMaterialSet(), range > 3 ? 3 : (int) range); if (bPlayer == null) { return null; - } else if (isWaterbendable(testBlock.getType())) { + } else if (isWaterbendable(player, null, testBlock) && (!isPlant(testBlock) || plantbending)) { return testBlock; } diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthPassive.java b/src/com/projectkorra/projectkorra/earthbending/EarthPassive.java index 17f074bb..023d79bc 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthPassive.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthPassive.java @@ -5,6 +5,7 @@ import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.util.TempBlock; @@ -27,6 +28,10 @@ public class EarthPassive { @SuppressWarnings("deprecation") public static boolean softenLanding(Player player) { + if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) { + return false; + } + Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN); BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (bPlayer == null) { diff --git a/src/com/projectkorra/projectkorra/firebending/FirePassive.java b/src/com/projectkorra/projectkorra/firebending/FirePassive.java index eff1dba4..5885071d 100644 --- a/src/com/projectkorra/projectkorra/firebending/FirePassive.java +++ b/src/com/projectkorra/projectkorra/firebending/FirePassive.java @@ -2,6 +2,8 @@ package com.projectkorra.projectkorra.firebending; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.Element; +import com.projectkorra.projectkorra.command.Commands; +import com.projectkorra.projectkorra.configuration.ConfigManager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -9,6 +11,9 @@ import org.bukkit.entity.Player; public class FirePassive { public static void handlePassive() { + if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) { + return; + } for (Player player : Bukkit.getOnlinePlayers()) { BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (bPlayer != null && bPlayer.canBendPassive(Element.FIRE)) { diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterPassive.java b/src/com/projectkorra/projectkorra/waterbending/WaterPassive.java index 25b6c2a7..4fafb8e3 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterPassive.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterPassive.java @@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.earthbending.EarthArmor; import com.projectkorra.projectkorra.util.TempBlock; @@ -17,6 +18,9 @@ import org.bukkit.entity.Player; public class WaterPassive { public static boolean applyNoFall(Player player) { + if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) { + return false; + } Block block = player.getLocation().getBlock(); Block fallBlock = block.getRelative(BlockFace.DOWN); if (TempBlock.isTempBlock(fallBlock) && (fallBlock.getType().equals(Material.ICE))) { @@ -32,6 +36,10 @@ public class WaterPassive { } public static void handlePassive() { + if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) { + return; + } + double swimSpeed = getSwimSpeed(); for (Player player : Bukkit.getServer().getOnlinePlayers()) {