diff --git a/src/com/projectkorra/projectkorra/PKListener.java b/src/com/projectkorra/projectkorra/PKListener.java index 98f9c2c6..da7a34a5 100644 --- a/src/com/projectkorra/projectkorra/PKListener.java +++ b/src/com/projectkorra/projectkorra/PKListener.java @@ -808,7 +808,7 @@ public class PKListener implements Listener { String e = "Nonbender"; ChatColor c = ChatColor.WHITE; if (bPlayer != null) { - if (player.hasPermission("bending.avatar") || (bPlayer.hasElement(Element.AIR) && bPlayer.hasElement(Element.EARTH) && bPlayer.hasElement(Element.FIRE) && bPlayer.hasElement(Element.WATER))) { + if (player.hasPermission("bending.avatar") || bPlayer.getElements().size() > 1) { c = Element.AVATAR.getColor(); e = Element.AVATAR.getName(); } else if (bPlayer.getElements().size() > 0) { diff --git a/src/com/projectkorra/projectkorra/ability/ElementalAbility.java b/src/com/projectkorra/projectkorra/ability/ElementalAbility.java index 6f8e9db8..861b23d0 100644 --- a/src/com/projectkorra/projectkorra/ability/ElementalAbility.java +++ b/src/com/projectkorra/projectkorra/ability/ElementalAbility.java @@ -9,6 +9,7 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.World.Environment; import org.bukkit.block.Block; +import org.bukkit.block.Container; import org.bukkit.block.data.BlockData; import org.bukkit.block.data.Waterlogged; import org.bukkit.entity.Player; @@ -215,8 +216,8 @@ public abstract class ElementalAbility extends CoreAbility { public static boolean isWater(final Block block) { if (block == null) { return false; - } else if (isWater(block.getType())) { - return true; + } else if (block.getState() instanceof Container) { + return false; } else { return isWater(block.getBlockData()); } diff --git a/src/com/projectkorra/projectkorra/airbending/AirBlast.java b/src/com/projectkorra/projectkorra/airbending/AirBlast.java index 15774a90..a2aee29f 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirBlast.java +++ b/src/com/projectkorra/projectkorra/airbending/AirBlast.java @@ -91,7 +91,7 @@ public class AirBlast extends AirAbility { ORIGINS.remove(player); if (entity != null) { - this.direction = GeneralMethods.getDirection(this.origin, entity.getLocation()).normalize(); + this.direction = GeneralMethods.getDirection(this.origin, GeneralMethods.getTargetedLocation(player, this.range, false, false)).normalize(); } else { this.direction = GeneralMethods.getDirection(this.origin, GeneralMethods.getTargetedLocation(player, this.range)).normalize(); } @@ -99,7 +99,9 @@ public class AirBlast extends AirAbility { this.origin = player.getEyeLocation(); this.direction = player.getEyeLocation().getDirection().normalize(); } - + if(!Double.isFinite(this.direction.getX()) || !Double.isFinite(this.direction.getY()) || !Double.isFinite(this.direction.getZ())) { + return; + } this.location = this.origin.clone(); this.bPlayer.addCooldown(this); this.start(); diff --git a/src/com/projectkorra/projectkorra/command/PresetCommand.java b/src/com/projectkorra/projectkorra/command/PresetCommand.java index 97708f6e..026ce425 100644 --- a/src/com/projectkorra/projectkorra/command/PresetCommand.java +++ b/src/com/projectkorra/projectkorra/command/PresetCommand.java @@ -40,6 +40,8 @@ public class PresetCommand extends PKCommand { private final String alreadyExists; private final String createdNewPreset; private final String cantEditBinds; + private final String playerNotFound; + private final String invalidName; public PresetCommand() { super("preset", "/bending preset [Preset]", ConfigManager.languageConfig.get().getString("Commands.Preset.Description"), new String[] { "preset", "presets", "pre", "set", "p" }); @@ -58,6 +60,8 @@ public class PresetCommand extends PKCommand { this.alreadyExists = ConfigManager.languageConfig.get().getString("Commands.Preset.AlreadyExists"); this.createdNewPreset = ConfigManager.languageConfig.get().getString("Commands.Preset.Created"); this.cantEditBinds = ConfigManager.languageConfig.get().getString("Commands.Preset.CantEditBinds"); + this.playerNotFound = ConfigManager.languageConfig.get().getString("Commands.Preset.PlayerNotFound"); + this.invalidName = ConfigManager.languageConfig.get().getString("Commands.Preset.InvalidName"); } @Override @@ -177,7 +181,7 @@ public class PresetCommand extends PKCommand { } return; } else { - GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.PlayerNotFound")); + GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.playerNotFound); } } else if (this.hasPermission(sender, "bind.assign") && Preset.presetExists(player, name)) { if (!Preset.presetExists(player, name)) { @@ -207,12 +211,15 @@ public class PresetCommand extends PKCommand { } return; } else { - GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + ConfigManager.languageConfig.get().getString("Commands.Preset.PlayerNotFound")); + GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.playerNotFound); } } } else if (Arrays.asList(createaliases).contains(args.get(0)) && this.hasPermission(sender, "create")) { // bending preset create name. final int limit = GeneralMethods.getMaxPresets(player); - + if (name == null) { + GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.invalidName); + return; + } if (Preset.presets.get(player.getUniqueId()) != null && Preset.presets.get(player.getUniqueId()).size() >= limit) { GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.reachedMax); return; diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java index 3c607726..757349fa 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java @@ -135,6 +135,7 @@ public class ConfigManager { config.addDefault("Commands.Preset.AlreadyExists", "A preset with that name already exists."); config.addDefault("Commands.Preset.BendingPermanentlyRemoved", "Your bending was permanently removed."); config.addDefault("Commands.Preset.PlayerNotFound", "Player not found."); + config.addDefault("Commands.Preset.InvalidName", "You must enter a valid name for your preset."); config.addDefault("Commands.Preset.MaxPresets", "You've reached your maximum number of presets."); config.addDefault("Commands.Preset.CantEditBinds", "You can't edit your binds right now!"); config.addDefault("Commands.Preset.Other.BendingPermanentlyRemoved", "That player's bending was permanently removed."); diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java b/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java index 4084b813..d9f3c97c 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java @@ -203,20 +203,20 @@ public class EarthGrab extends EarthAbility { this.mHandler = new MovementHandler(this.target, this); this.mHandler.stop(Element.EARTH.getColor() + "* Trapped *"); - if (this.target instanceof Player || this.target instanceof Zombie || this.target instanceof Skeleton) { - final ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS); - final LeatherArmorMeta legmeta = (LeatherArmorMeta) legs.getItemMeta(); - legmeta.setColor(Color.fromRGB(EarthArmor.getColor(m))); - legs.setItemMeta(legmeta); - - final ItemStack feet = new ItemStack(Material.LEATHER_BOOTS); - final LeatherArmorMeta footmeta = (LeatherArmorMeta) feet.getItemMeta(); - footmeta.setColor(Color.fromRGB(EarthArmor.getColor(m))); - feet.setItemMeta(footmeta); - - final ItemStack[] pieces = { (this.target.getEquipment().getArmorContents()[0] == null || this.target.getEquipment().getArmorContents()[0].getType() == Material.AIR) ? feet : null, (this.target.getEquipment().getArmorContents()[1] == null || this.target.getEquipment().getArmorContents()[1].getType() == Material.AIR) ? legs : null, null, null }; - this.armor = new TempArmor(this.target, 36000000L, this, pieces); - } +// if (this.target instanceof Player || this.target instanceof Zombie || this.target instanceof Skeleton) { +// final ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS); +// final LeatherArmorMeta legmeta = (LeatherArmorMeta) legs.getItemMeta(); +// legmeta.setColor(Color.fromRGB(EarthArmor.getColor(m))); +// legs.setItemMeta(legmeta); +// +// final ItemStack feet = new ItemStack(Material.LEATHER_BOOTS); +// final LeatherArmorMeta footmeta = (LeatherArmorMeta) feet.getItemMeta(); +// footmeta.setColor(Color.fromRGB(EarthArmor.getColor(m))); +// feet.setItemMeta(footmeta); +// +// final ItemStack[] pieces = { (this.target.getEquipment().getArmorContents()[0] == null || this.target.getEquipment().getArmorContents()[0].getType() == Material.AIR) ? feet : null, (this.target.getEquipment().getArmorContents()[1] == null || this.target.getEquipment().getArmorContents()[1].getType() == Material.AIR) ? legs : null, null, null }; +// this.armor = new TempArmor(this.target, 36000000L, this, pieces); +// } playEarthbendingSound(this.target.getLocation()); this.initiated = true;