mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-01-03 13:38:20 +00:00
Fixed Toggling Passives & Underwater Select Range (#556)
• 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)
This commit is contained in:
parent
bd3a40fd43
commit
a30b4918b4
5 changed files with 24 additions and 2 deletions
|
@ -232,6 +232,10 @@ public class BendingPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBendPassive(Element element) {
|
public boolean canBendPassive(Element element) {
|
||||||
|
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
List<String> disabledWorlds = getConfig().getStringList("Properties.DisabledWorlds");
|
List<String> disabledWorlds = getConfig().getStringList("Properties.DisabledWorlds");
|
||||||
|
|
||||||
if (element == null || player == null) {
|
if (element == null || player == null) {
|
||||||
|
|
|
@ -190,10 +190,10 @@ public abstract class WaterAbility extends ElementalAbility {
|
||||||
Vector vector = location.getDirection().clone().normalize();
|
Vector vector = location.getDirection().clone().normalize();
|
||||||
|
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
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) {
|
if (bPlayer == null) {
|
||||||
return null;
|
return null;
|
||||||
} else if (isWaterbendable(testBlock.getType())) {
|
} else if (isWaterbendable(player, null, testBlock) && (!isPlant(testBlock) || plantbending)) {
|
||||||
return testBlock;
|
return testBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.projectkorra.projectkorra.Element;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||||
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
|
@ -27,6 +28,10 @@ public class EarthPassive {
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static boolean softenLanding(Player player) {
|
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);
|
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.projectkorra.projectkorra.firebending;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import com.projectkorra.projectkorra.Element;
|
import com.projectkorra.projectkorra.Element;
|
||||||
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -9,6 +11,9 @@ import org.bukkit.entity.Player;
|
||||||
public class FirePassive {
|
public class FirePassive {
|
||||||
|
|
||||||
public static void handlePassive() {
|
public static void handlePassive() {
|
||||||
|
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
if (bPlayer != null && bPlayer.canBendPassive(Element.FIRE)) {
|
if (bPlayer != null && bPlayer.canBendPassive(Element.FIRE)) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import com.projectkorra.projectkorra.Element;
|
import com.projectkorra.projectkorra.Element;
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthArmor;
|
import com.projectkorra.projectkorra.earthbending.EarthArmor;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
@ -17,6 +18,9 @@ import org.bukkit.entity.Player;
|
||||||
public class WaterPassive {
|
public class WaterPassive {
|
||||||
|
|
||||||
public static boolean applyNoFall(Player player) {
|
public static boolean applyNoFall(Player player) {
|
||||||
|
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Block block = player.getLocation().getBlock();
|
Block block = player.getLocation().getBlock();
|
||||||
Block fallBlock = block.getRelative(BlockFace.DOWN);
|
Block fallBlock = block.getRelative(BlockFace.DOWN);
|
||||||
if (TempBlock.isTempBlock(fallBlock) && (fallBlock.getType().equals(Material.ICE))) {
|
if (TempBlock.isTempBlock(fallBlock) && (fallBlock.getType().equals(Material.ICE))) {
|
||||||
|
@ -32,6 +36,10 @@ public class WaterPassive {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handlePassive() {
|
public static void handlePassive() {
|
||||||
|
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
double swimSpeed = getSwimSpeed();
|
double swimSpeed = getSwimSpeed();
|
||||||
|
|
||||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
|
|
Loading…
Reference in a new issue