From 92d32bcb9aaf61c14d8d77245d6899d6c24f4b9f Mon Sep 17 00:00:00 2001 From: Sobki Date: Mon, 12 Sep 2016 07:14:02 +1000 Subject: [PATCH] Tremorsense now takes priority over Illumination, IceSpear sphere now forms underwater (#575) --- src/com/projectkorra/projectkorra/PKListener.java | 7 ++++++- .../projectkorra/configuration/ConfigManager.java | 1 + .../projectkorra/earthbending/Tremorsense.java | 14 +++++++++++--- .../projectkorra/firebending/FirePassive.java | 7 +++++-- .../projectkorra/firebending/Illumination.java | 6 ++++++ .../projectkorra/waterbending/WaterArms.java | 2 +- 6 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/com/projectkorra/projectkorra/PKListener.java b/src/com/projectkorra/projectkorra/PKListener.java index a1c1252d..afb434b7 100644 --- a/src/com/projectkorra/projectkorra/PKListener.java +++ b/src/com/projectkorra/projectkorra/PKListener.java @@ -1625,7 +1625,12 @@ public class PKListener implements Listener { new HeatControlExtinguish(player); } if (abil.equalsIgnoreCase("Illumination")) { - bPlayer.toggleIllumination(); + if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.Illumination.Passive")) { + bPlayer.toggleIllumination(); + } else { + new Illumination(player); + } + } if (abil.equalsIgnoreCase("FireBurst")) { FireBurst.coneBurst(player); diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java index 824282d1..b06b5186 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java @@ -1026,6 +1026,7 @@ public class ConfigManager { config.addDefault("Abilities.Fire.HeatControl.Cook.CookTime", 2000); config.addDefault("Abilities.Fire.Illumination.Enabled", true); + config.addDefault("Abilities.Fire.Illumination.Passive", true); config.addDefault("Abilities.Fire.Illumination.Range", 5); config.addDefault("Abilities.Fire.Illumination.Cooldown", 500); config.addDefault("Abilities.Fire.Illumination.LightThreshold", 7); diff --git a/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java b/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java index f472b109..7e6ed5c9 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java +++ b/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java @@ -131,15 +131,23 @@ public class Tremorsense extends EarthAbility { public static void manage(Server server) { for (Player player : server.getOnlinePlayers()) { - BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); - if (bPlayer != null && !hasAbility(player, Tremorsense.class) - && bPlayer.canBendIgnoreBinds(getAbility("Tremorsense"))) { + if (canTremorSense(player) && !hasAbility(player, Tremorsense.class)) { new Tremorsense(player); } } } + public static boolean canTremorSense(Player player) { + BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); + + if (bPlayer != null && bPlayer.canBendIgnoreBindsCooldowns(getAbility("Tremorsense"))) { + return true; + } + + return false; + } + public static Map getBlocks() { return BLOCKS; } diff --git a/src/com/projectkorra/projectkorra/firebending/FirePassive.java b/src/com/projectkorra/projectkorra/firebending/FirePassive.java index 9208fc94..f018fd58 100644 --- a/src/com/projectkorra/projectkorra/firebending/FirePassive.java +++ b/src/com/projectkorra/projectkorra/firebending/FirePassive.java @@ -8,6 +8,7 @@ import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.ConfigManager; +import com.projectkorra.projectkorra.earthbending.Tremorsense; public class FirePassive { @@ -23,8 +24,10 @@ public class FirePassive { } if (bPlayer != null && !CoreAbility.hasAbility(player, Illumination.class) - && bPlayer.canBendIgnoreBinds(CoreAbility.getAbility("Illumination"))) { - new Illumination(player); + && bPlayer.canBendIgnoreBinds(CoreAbility.getAbility("Illumination")) && ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.Illumination.Passive")) { + if (!Tremorsense.canTremorSense(player)) { + new Illumination(player); + } } } } diff --git a/src/com/projectkorra/projectkorra/firebending/Illumination.java b/src/com/projectkorra/projectkorra/firebending/Illumination.java index 4840c8b8..e205d34c 100644 --- a/src/com/projectkorra/projectkorra/firebending/Illumination.java +++ b/src/com/projectkorra/projectkorra/firebending/Illumination.java @@ -11,6 +11,7 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.earthbending.Tremorsense; import com.projectkorra.projectkorra.util.TempBlock; public class Illumination extends FireAbility { @@ -69,6 +70,11 @@ public class Illumination extends FireAbility { return; } + if (Tremorsense.canTremorSense(player)) { + remove(); + return; + } + if (oldLevel > this.lightThreshold) { remove(); return; diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterArms.java b/src/com/projectkorra/projectkorra/waterbending/WaterArms.java index 325438ef..56f5a015 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterArms.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterArms.java @@ -35,7 +35,7 @@ public class WaterArms extends WaterAbility { } private static final Map BLOCK_REVERT_TIMES = new ConcurrentHashMap(); - private static final Integer[] UNBREAKABLES = { 7, 8, 9, 10, 11, 49, 54, 90, 119, 120, 130, 146 }; + private static final Integer[] UNBREAKABLES = { 7, 10, 11, 49, 54, 90, 119, 120, 130, 146 }; private boolean cooldownLeft; private boolean cooldownRight;