diff --git a/lib/Residence10.5.0.jar b/lib/Residence10.5.0.jar new file mode 100644 index 00000000..aef55aab Binary files /dev/null and b/lib/Residence10.5.0.jar differ diff --git a/src/com/projectkorra/projectkorra/ability/EarthAbility.java b/src/com/projectkorra/projectkorra/ability/EarthAbility.java index 4a7419b9..6c5a11dd 100644 --- a/src/com/projectkorra/projectkorra/ability/EarthAbility.java +++ b/src/com/projectkorra/projectkorra/ability/EarthAbility.java @@ -35,7 +35,6 @@ public abstract class EarthAbility extends ElementalAbility { private static final ConcurrentHashMap MOVED_EARTH = new ConcurrentHashMap(); private static final ConcurrentHashMap TEMP_AIR_LOCATIONS = new ConcurrentHashMap(); private static final ArrayList PREVENT_PHYSICS = new ArrayList(); - //private static final ItemStack DIAMOND_PICKAXE = new ItemStack(Material.DIAMOND_PICKAXE); public EarthAbility(Player player) { super(player); @@ -70,10 +69,6 @@ public abstract class EarthAbility extends ElementalAbility { return getTargetEarthBlock(player, range); } - public boolean isEarthbendable(Block block) { - return isEarthbendable(player, getName(), block); - } - @Override public boolean isExplosiveAbility() { return false; @@ -83,6 +78,22 @@ public abstract class EarthAbility extends ElementalAbility { public boolean isIgniteAbility() { return false; } + + public static boolean isEarthbendable(Material material) { + return isEarth(material) || isMetal(material) || isSand(material) || isLava(material); + } + + public boolean isEarthbendable(Block block) { + return isEarthbendable(player, getName(), block); + } + + public static boolean isEarthbendable(Player player, Block block) { + return isEarthbendable(player, null, block); + } + + public boolean isLavabendable(Block block) { + return isLavabendable(player, block); + } public boolean isMetalbendable(Block block) { return isMetalbendable(block.getType()); @@ -91,6 +102,14 @@ public abstract class EarthAbility extends ElementalAbility { public boolean isMetalbendable(Material material) { return isMetalbendable(player, material); } + + public boolean isSandbendable(Block block) { + return isSandbendable(block.getType()); + } + + public boolean isSandbendable(Material material) { + return isSandbendable(player, material); + } public void moveEarth(Block block, Vector direction, int chainlength) { moveEarth(block, direction, chainlength, true); @@ -267,8 +286,10 @@ public abstract class EarthAbility extends ElementalAbility { Block testBlock = player.getTargetBlock(getTransparentMaterialSet(), (int) range); if (bPlayer == null) { return null; - } else if (isEarthbendable(player, testBlock) || isMetalbendable(player, testBlock.getType())) { + } else if (isEarthbendable(testBlock.getType())) { return testBlock; + } else if (!isTransparent(player, testBlock)) { + return null; } Location location = player.getEyeLocation(); @@ -308,7 +329,7 @@ public abstract class EarthAbility extends ElementalAbility { if (GeneralMethods.isRegionProtectedFromBuild(player, abilityName, location)) { continue; } - if (isLavabendable(block)) { + if (isLavabendable(player, block)) { if (TempBlock.isTempBlock(block)) { TempBlock tb = TempBlock.get(block); byte full = 0x0; @@ -381,14 +402,6 @@ public abstract class EarthAbility extends ElementalAbility { return TEMP_AIR_LOCATIONS; } - public static boolean isEarthbendable(Material material) { - return isEarth(material) || isMetal(material) || isSand(material); - } - - public static boolean isEarthbendable(Player player, Block block) { - return isEarthbendable(player, null, block); - } - public static boolean isEarthbendable(Player player, String abilityName, Block block) { BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (bPlayer == null || !isEarthbendable(block.getType()) || PREVENT_EARTHBENDING.contains(block) @@ -396,6 +409,10 @@ public abstract class EarthAbility extends ElementalAbility { return false; } else if (isMetal(block) && !bPlayer.canMetalbend()) { return false; + } else if (isSand(block) && !bPlayer.canSandbend()) { + return false; + } else if (isLava(block) && !bPlayer.canLavabend()) { + return false; } return true; } @@ -403,9 +420,9 @@ public abstract class EarthAbility extends ElementalAbility { public static boolean isEarthRevertOn() { return getConfig().getBoolean("Properties.Earth.RevertEarthbending"); } - + @SuppressWarnings("deprecation") - public static boolean isLavabendable(Block block) { + public static boolean isLavabendable(Player player, Block block) { byte full = 0x0; if (TempBlock.isTempBlock(block)) { TempBlock tblock = TempBlock.instances.get(block); @@ -423,6 +440,11 @@ public abstract class EarthAbility extends ElementalAbility { BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); return bPlayer == null ? null : isMetal(material) && bPlayer.canMetalbend(); } + + public static boolean isSandbendable(Player player, Material material) { + BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); + return bPlayer == null ? null : isSand(material) && bPlayer.canSandbend(); + } @SuppressWarnings("deprecation") public static void moveEarthBlock(Block source, Block target) { diff --git a/src/com/projectkorra/projectkorra/ability/ElementalAbility.java b/src/com/projectkorra/projectkorra/ability/ElementalAbility.java index c2f68048..4a3bece3 100644 --- a/src/com/projectkorra/projectkorra/ability/ElementalAbility.java +++ b/src/com/projectkorra/projectkorra/ability/ElementalAbility.java @@ -23,7 +23,7 @@ import com.projectkorra.rpg.event.EventManager; public abstract class ElementalAbility extends CoreAbility { private static final Integer[] TRANSPARENT_MATERIAL = { 0, 6, 8, 9, 10, 11, 30, 31, 32, 37, 38, 39, 40, 50, 51, 59, 78, 83, 106, 175 }; - private static final Integer[] PLANT_IDS = { 6, 18, 31, 37, 38, 39, 40, 59, 81, 83, 86, 99, 100, 103, 104, 105, 106, 111, 161, 175 }; + //private static final Integer[] PLANT_IDS = { 6, 18, 31, 37, 38, 39, 40, 59, 81, 83, 86, 99, 100, 103, 104, 105, 106, 111, 161, 175 }; private static final PotionEffectType[] POSITIVE_EFFECTS = {PotionEffectType.ABSORPTION, PotionEffectType.DAMAGE_RESISTANCE, PotionEffectType.FAST_DIGGING, PotionEffectType.FIRE_RESISTANCE, PotionEffectType.HEAL, PotionEffectType.HEALTH_BOOST, PotionEffectType.INCREASE_DAMAGE, PotionEffectType.JUMP, PotionEffectType.NIGHT_VISION, PotionEffectType.REGENERATION, PotionEffectType.SATURATION, PotionEffectType.SPEED, PotionEffectType.WATER_BREATHING}; @@ -84,11 +84,11 @@ public abstract class ElementalAbility extends CoreAbility { } public static boolean isIce(Block block) { - return isIce(block.getType()); + return block != null ? isIce(block.getType()) : false; } public static boolean isIce(Material material) { - return material == Material.ICE || material == Material.PACKED_ICE; + return getConfig().getStringList("Properties.Water.IceBlocks").contains(material.toString()); } public static boolean isLava(Block block) { @@ -167,14 +167,12 @@ public abstract class ElementalAbility extends CoreAbility { return false; } - @SuppressWarnings("deprecation") public static boolean isPlant(Block block) { - if (block == null) { - return false; - } else if (Arrays.asList(PLANT_IDS).contains(block.getTypeId())) { - return true; - } - return false; + return block != null ? isPlant(block.getType()) : false; + } + + public static boolean isPlant(Material material) { + return getConfig().getStringList("Properties.Water.PlantBlocks").contains(material.toString()); } public static boolean isPositiveEffect(PotionEffectType effect) { diff --git a/src/com/projectkorra/projectkorra/ability/WaterAbility.java b/src/com/projectkorra/projectkorra/ability/WaterAbility.java index cb351956..7b3cd7b6 100644 --- a/src/com/projectkorra/projectkorra/ability/WaterAbility.java +++ b/src/com/projectkorra/projectkorra/ability/WaterAbility.java @@ -12,6 +12,7 @@ import com.projectkorra.projectkorra.waterbending.WaterArms; import com.projectkorra.projectkorra.waterbending.WaterSpout; import com.projectkorra.rpg.RPGMethods; +import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; @@ -73,13 +74,41 @@ public abstract class WaterAbility extends ElementalAbility { public boolean isIgniteAbility() { return false; } - - public boolean isWaterbendable(Block block) { - return isWaterbendable(block, player); + + public boolean isIcebendable(Block block) { + return isIcebendable(block.getType()); } - public static boolean canBendPackedIce() { - return getConfig().getBoolean("Properties.Water.CanBendPackedIce"); + public boolean isIcebendable(Material material) { + return isIcebendable(player, material); + } + + public boolean isIcebendable(Player player, Material material) { + return isIcebendable(player, material, false); + } + + public boolean isPlantbendable (Block block) { + return isPlantbendable(block.getType()); + } + + public boolean isPlantbendable (Material material) { + return isPlantbendable(player, material); + } + + public boolean isPlantbendable (Player player, Material material) { + return isPlantbendable(player, material, false); + } + + public boolean isWaterbendable(Block block) { + return isWaterbendable(player, block); + } + + public boolean isWaterbendable(Player player, Block block) { + return isWaterbendable(player, null, block); + } + + public static boolean isWaterbendable(Material material) { + return isWater(material) || isIce(material) || isPlant(material); } public static Block getIceSourceBlock(Player player, double range) { @@ -90,7 +119,7 @@ public abstract class WaterAbility extends ElementalAbility { if (GeneralMethods.isRegionProtectedFromBuild(player, "IceBlast", location)) { continue; } - if (isIcebendable(block)) { + if (isIcebendable(player, block.getType(), false)) { if (TempBlock.isTempBlock(block)) { continue; } @@ -134,7 +163,7 @@ public abstract class WaterAbility extends ElementalAbility { Block block = location.clone().add(vector.clone().multiply(i)).getBlock(); if (GeneralMethods.isRegionProtectedFromBuild(player, "PlantDisc", location)) { continue; - } else if (isPlantbendable(block, onlyLeaves)) { + } else if (isPlantbendable (player, block.getType(), onlyLeaves)) { if (TempBlock.isTempBlock(block)) { continue; } @@ -160,11 +189,21 @@ public abstract class WaterAbility extends ElementalAbility { Location location = player.getEyeLocation(); Vector vector = location.getDirection().clone().normalize(); + BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); + Block testBlock = player.getTargetBlock(getTransparentMaterialSet(), (int) range); + if (bPlayer == null) { + return null; + } else if (isWaterbendable(testBlock.getType())) { + return testBlock; + } else if (!isTransparent(player, testBlock)) { + return null; + } + for (double i = 0; i <= range; i++) { Block block = location.clone().add(vector.clone().multiply(i)).getBlock(); if (GeneralMethods.isRegionProtectedFromBuild(player, "WaterManipulation", location)) { continue; - } else if (isWaterbendable(block, player) && (!isPlant(block) || plantbending)) { + } else if (isWaterbendable(player, null, block) && (!isPlant(block) || plantbending)) { if (TempBlock.isTempBlock(block)) { TempBlock tb = TempBlock.get(block); byte full = 0x0; @@ -189,33 +228,31 @@ public abstract class WaterAbility extends ElementalAbility { } return adjacent; } + + public static boolean isIcebendable(Player player, Material material, boolean onlyIce) { + BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); + if(onlyIce) { + return bPlayer == null ? null : isIce(material) && bPlayer.canIcebend() && isIce(material); + } else { + return bPlayer == null ? null : isIce(material) && bPlayer.canIcebend(); + } + } + + public static boolean isPlantbendable(Player player, Material material, boolean onlyLeaves) { + BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); + if(onlyLeaves) { + return bPlayer == null ? null : isPlant(material) && bPlayer.canPlantbend() && isLeaves(material); + } else { + return bPlayer == null ? null : isPlant(material) && bPlayer.canPlantbend(); + } + } + + public static boolean isLeaves(Block block) { + return block != null ? isLeaves(block.getType()) : false; + } - public static boolean isIcebendable(Block block) { - return block != null ? isIcebendable(block.getType()) : false; - } - - public static boolean isIcebendable(Material material) { - if (material == Material.ICE || material == Material.SNOW) { - return true; - } else if (material == Material.PACKED_ICE && canBendPackedIce()) { - return true; - } - return false; - } - - public static boolean isPlantbendable(Block block) { - return isPlantbendable(block, false); - } - - public static boolean isPlantbendable(Block block, boolean leavesOnly) { - if (block.getType() == Material.LEAVES) { - return true; - } else if (block.getType() == Material.LEAVES_2) { - return true; - } else if (isPlant(block) && !leavesOnly) { - return true; - } - return false; + public static boolean isLeaves(Material material) { + return material == Material.LEAVES || material == Material.LEAVES; } public static boolean isSnow(Block block) { @@ -227,22 +264,23 @@ public abstract class WaterAbility extends ElementalAbility { } @SuppressWarnings("deprecation") - public static boolean isWaterbendable(Block block, Player player) { + public static boolean isWaterbendable(Player player, String abilityName, Block block) { byte full = 0x0; BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); + if (bPlayer == null || !isWaterbendable(block.getType()) || GeneralMethods.isRegionProtectedFromBuild(player, abilityName, block.getLocation())) { + return false; + } if (TempBlock.isTempBlock(block)) { return false; } else if (isWater(block) && block.getData() == full) { return true; - } else if (block.getType() == Material.ICE || block.getType() == Material.SNOW) { - return true; - } else if (block.getType() == Material.PACKED_ICE && canBendPackedIce()) { - return true; - } else if (bPlayer != null && bPlayer.canPlantbend() && isPlant(block)) { - return true; + } else if (isIce(block) && !bPlayer.canIcebend()) { + return false; + } else if (isPlant(block) && !bPlayer.canPlantbend()) { + return false; } - return false; + return true; } public static void playFocusWaterEffect(Block block) { diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java index 27d4f625..246fb8ca 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java @@ -1,5 +1,6 @@ package com.projectkorra.projectkorra.configuration; +import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; import java.io.File; @@ -98,35 +99,59 @@ public class ConfigManager { case DEFAULT: config = defaultConfig.get(); - ArrayList earths = new ArrayList(); - earths.add("STONE"); - earths.add("CLAY"); - earths.add("COAL_ORE"); - earths.add("DIAMOND_ORE"); - earths.add("DIRT"); - earths.add("GOLD_ORE"); - earths.add("GRASS"); - earths.add("GRAVEL"); - earths.add("IRON_ORE"); - earths.add("LAPIS_ORE"); - earths.add("NETHERRACK"); - earths.add("QUARTZ_ORE"); - earths.add("REDSTONE_ORE"); - earths.add("SAND"); - earths.add("SANDSTONE"); - earths.add("RED_SANDSTONE"); - earths.add("MYCEL"); + ArrayList earthBlocks = new ArrayList(); + earthBlocks.add("DIRT"); + earthBlocks.add("MYCEL"); + earthBlocks.add("GRASS"); + earthBlocks.add("STONE"); + earthBlocks.add("GRAVEL"); + earthBlocks.add("CLAY"); + earthBlocks.add("COAL_ORE"); + earthBlocks.add("IRON_ORE"); + earthBlocks.add("GOLD_ORE"); + earthBlocks.add("REDSTONE_ORE"); + earthBlocks.add("LAPIS_ORE"); + earthBlocks.add("DIAMOND_ORE"); + earthBlocks.add("NETHERRACK"); + earthBlocks.add("QUARTZ_ORE"); - ArrayList metals = new ArrayList(); - metals.add("IRON_BLOCK"); - metals.add("GOLD_BLOCK"); - metals.add("QUARTZ_BLOCK"); + ArrayList metalBlocks = new ArrayList(); + metalBlocks.add("IRON_BLOCK"); + metalBlocks.add("GOLD_BLOCK"); + metalBlocks.add("QUARTZ_BLOCK"); - ArrayList sands = new ArrayList(); - sands.add("SAND"); - sands.add("SANDSTONE"); - sands.add("RED_SAND"); - sands.add("RED_SANDSTONE"); + ArrayList sandBlocks = new ArrayList(); + sandBlocks.add("SAND"); + sandBlocks.add("SANDSTONE"); + sandBlocks.add("RED_SAND"); + sandBlocks.add("RED_SANDSTONE"); + + ArrayList iceBlocks = new ArrayList(); + iceBlocks.add("ICE"); + iceBlocks.add("PACKED_ICE"); + + ArrayList plantBlocks = new ArrayList(); + plantBlocks.add("SAPLING"); + plantBlocks.add("LEAVES"); + plantBlocks.add("LEAVES_2"); + plantBlocks.add("DEAD_BUSH"); + plantBlocks.add("YELLOW_FLOWER"); + plantBlocks.add("RED_ROSE"); + plantBlocks.add("RED_MUSHROOM"); + plantBlocks.add("BROWN_MUSHROOM"); + plantBlocks.add("CACTUS"); + plantBlocks.add("PUMPKIN"); + plantBlocks.add("HUGE_MUSHROOM_1"); + plantBlocks.add("HUGE_MUSHROOM_2"); + plantBlocks.add("MELON_BLOCK"); + plantBlocks.add("VINE"); + plantBlocks.add("WATER_LILY"); + plantBlocks.add("DOUBLE_PLANT"); + plantBlocks.add("CROPS"); + plantBlocks.add("LONG_GRASS"); + plantBlocks.add("SUGAR_CANE_BLOCK"); + plantBlocks.add("PUMPKIN_STEM"); + plantBlocks.add("MELON_STEM"); config.addDefault("Properties.Chat.Enable", true); config.addDefault("Properties.Chat.Format", ": "); @@ -160,10 +185,6 @@ public class ConfigManager { config.addDefault("Properties.HorizontalCollisionPhysics.WallDamageMinimumDistance", 5.0); config.addDefault("Properties.HorizontalCollisionPhysics.WallDamageCap", 6.0); - config.addDefault("Properties.CustomItems.GrapplingHook.Enable", true); - config.addDefault("Properties.CustomItems.GrapplingHook.IronUses", 25); - config.addDefault("Properties.CustomItems.GrapplingHook.GoldUses", 50); - config.addDefault("Properties.RegionProtection.AllowHarmlessAbilities", true); config.addDefault("Properties.RegionProtection.RespectWorldGuard", true); config.addDefault("Properties.RegionProtection.RespectGriefPrevention", true); @@ -180,10 +201,10 @@ public class ConfigManager { config.addDefault("Properties.Air.PlaySound", true); config.addDefault("Properties.Water.CanBendWithWeapons", true); + config.addDefault("Properties.Water.IceBlocks", iceBlocks); + config.addDefault("Properties.Water.PlantBlocks", plantBlocks); config.addDefault("Properties.Water.NightFactor", 1.5); config.addDefault("Properties.Water.FullMoonFactor", 2.0); - config.addDefault("Properties.Water.CanBendPackedIce", true); - config.addDefault("Properties.Water.CanBendFromBentBlocks", false); config.addDefault("Properties.Water.PlaySound", true); config.addDefault("Properties.Water.NightMessage", "You feel the strength of the rising moon empowering your waterbending."); config.addDefault("Properties.Water.DayMessage", "You feel the empowering of your waterbending subside as the moon sets."); @@ -192,9 +213,9 @@ public class ConfigManager { config.addDefault("Properties.Earth.SafeRevert", true); config.addDefault("Properties.Earth.RevertCheckTime", 300000); config.addDefault("Properties.Earth.CanBendWithWeapons", true); - config.addDefault("Properties.Earth.EarthBlocks", earths); - config.addDefault("Properties.Earth.MetalBlocks", metals); - config.addDefault("Properties.Earth.SandBlocks", sands); + config.addDefault("Properties.Earth.EarthBlocks", earthBlocks); + config.addDefault("Properties.Earth.MetalBlocks", metalBlocks); + config.addDefault("Properties.Earth.SandBlocks", sandBlocks); config.addDefault("Properties.Earth.MetalPowerFactor", 1.5); config.addDefault("Properties.Earth.PlaySound", true); diff --git a/src/com/projectkorra/projectkorra/earthbending/LavaSurgeWall.java b/src/com/projectkorra/projectkorra/earthbending/LavaSurgeWall.java index 5fa1d360..e871617f 100644 --- a/src/com/projectkorra/projectkorra/earthbending/LavaSurgeWall.java +++ b/src/com/projectkorra/projectkorra/earthbending/LavaSurgeWall.java @@ -288,7 +288,7 @@ public class LavaSurgeWall extends LavaAbility { if (!hasAbility(player, LavaSurgeWall.class)) { new LavaSurgeWave(player); return; - } else if (isLavabendable(player.getTargetBlock((HashSet) null, SURGE_WAVE_RANGE))) { + } else if (isLavabendable(player, player.getTargetBlock((HashSet) null, SURGE_WAVE_RANGE))) { new LavaSurgeWave(player); return; } diff --git a/src/com/projectkorra/projectkorra/firebending/FireBlast.java b/src/com/projectkorra/projectkorra/firebending/FireBlast.java index 4c07ca79..f06482a2 100644 --- a/src/com/projectkorra/projectkorra/firebending/FireBlast.java +++ b/src/com/projectkorra/projectkorra/firebending/FireBlast.java @@ -138,7 +138,7 @@ public class FireBlast extends FireAbility { && !safeBlocks.contains(block) && !GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) { if (canFireGrief()) { - if (WaterAbility.isPlantbendable(block)) { + if (WaterAbility.isPlantbendable(player, block.getType(), false)) { new PlantRegrowth(player, block); } block.setType(Material.FIRE); diff --git a/src/com/projectkorra/projectkorra/firebending/FireCombo.java b/src/com/projectkorra/projectkorra/firebending/FireCombo.java index f5dc481e..e63053d5 100644 --- a/src/com/projectkorra/projectkorra/firebending/FireCombo.java +++ b/src/com/projectkorra/projectkorra/firebending/FireCombo.java @@ -392,7 +392,7 @@ public class FireCombo extends FireAbility implements ComboAbility { } Block topBlock = GeneralMethods.getTopBlock(location, 2, -4); - if (topBlock == null || (WaterAbility.isWaterbendable(topBlock, player) && !isPlant(topBlock))) { + if (topBlock == null || (WaterAbility.isWaterbendable(player, ability, topBlock) && !isPlant(topBlock))) { remove(); return; } else if (topBlock.getType() == Material.FIRE || ElementalAbility.isPlant(topBlock)) { diff --git a/src/com/projectkorra/projectkorra/util/BlockSource.java b/src/com/projectkorra/projectkorra/util/BlockSource.java index c8e5f660..5a73b490 100644 --- a/src/com/projectkorra/projectkorra/util/BlockSource.java +++ b/src/com/projectkorra/projectkorra/util/BlockSource.java @@ -62,7 +62,7 @@ public class BlockSource { if (WaterAbility.isPlant(waterBlock)) { putSource(player, waterBlock, BlockSourceType.PLANT, clickType); } - if (WaterAbility.isIcebendable(waterBlock)) { + if (WaterAbility.isIce(waterBlock)) { putSource(player, waterBlock, BlockSourceType.ICE, clickType); } } @@ -360,17 +360,17 @@ public class BlockSource { return false; } else if (Math.abs(info.getPlayer().getLocation().distance(info.getBlock().getLocation())) > range) { return false; - } else if (info.getSourceType() == BlockSourceType.WATER && !WaterAbility.isWaterbendable(info.getBlock(), info.getPlayer())) { + } else if (info.getSourceType() == BlockSourceType.WATER && !WaterAbility.isWaterbendable(info.getPlayer(), null, info.getBlock())) { return false; - } else if (info.getSourceType() == BlockSourceType.ICE && !WaterAbility.isIcebendable(info.getBlock())) { + } else if (info.getSourceType() == BlockSourceType.ICE && !WaterAbility.isIcebendable(info.getPlayer(), info.getBlock().getType(), false)) { return false; - } else if (info.getSourceType() == BlockSourceType.PLANT && (!WaterAbility.isPlant(info.getBlock()) || !WaterAbility.isWaterbendable(info.getBlock(), info.getPlayer()))) { + } else if (info.getSourceType() == BlockSourceType.PLANT && (!WaterAbility.isPlant(info.getBlock()) || !WaterAbility.isWaterbendable(info.getPlayer(), null, info.getBlock()))) { return false; } else if (info.getSourceType() == BlockSourceType.EARTH && !EarthAbility.isEarthbendable(info.getPlayer(), info.getBlock())) { return false; } else if (info.getSourceType() == BlockSourceType.METAL && (!EarthAbility.isMetal(info.getBlock()) || !EarthAbility.isEarthbendable(info.getPlayer(), info.getBlock()))) { return false; - } else if (info.getSourceType() == BlockSourceType.LAVA && (!EarthAbility.isLava(info.getBlock()) || !EarthAbility.isLavabendable(info.getBlock()))) { + } else if (info.getSourceType() == BlockSourceType.LAVA && (!EarthAbility.isLava(info.getBlock()) || !EarthAbility.isLavabendable(info.getPlayer(), info.getBlock()))) { return false; } return true; diff --git a/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java b/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java index 3c4de52a..496a54b7 100644 --- a/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java +++ b/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java @@ -379,7 +379,7 @@ public class OctopusForm extends WaterAbility { } newBlocks.add(tblock); } - } else if (isWaterbendable(block, player) || block.getType() == Material.FIRE || block.getType() == Material.AIR) { + } else if (isWaterbendable(player, block) || block.getType() == Material.FIRE || block.getType() == Material.AIR) { newBlocks.add(new TempBlock(block, Material.STATIONARY_WATER, (byte) 8)); } } diff --git a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java index a0937564..61719f94 100644 --- a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java +++ b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java @@ -400,7 +400,7 @@ public class SurgeWall extends WaterAbility { wave = new SurgeWave(player); return; } else { - if (isWaterbendable(player.getTargetBlock((HashSet) null, range), player)) { + if (isWaterbendable(player, null, player.getTargetBlock((HashSet) null, range))) { wave = new SurgeWave(player); return; } diff --git a/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java b/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java index 9982b073..738736e2 100644 --- a/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java @@ -256,7 +256,7 @@ public class SurgeWave extends WaterAbility { if (!GeneralMethods.isRegionProtectedFromBuild(this, location) && (((blockl.getType() == Material.AIR || blockl.getType() == Material.FIRE || isPlant(blockl) || isWater(blockl) - || isWaterbendable(blockl, player))) + || isWaterbendable(player, blockl))) && blockl.getType() != Material.LEAVES)) { for (double i = 0; i <= currentRadius; i += .5) { for (double angle = 0; angle < 360; angle += 10) { diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterPassive.java b/src/com/projectkorra/projectkorra/waterbending/WaterPassive.java index e8bc95f7..25b6c2a7 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterPassive.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterPassive.java @@ -21,11 +21,11 @@ public class WaterPassive { Block fallBlock = block.getRelative(BlockFace.DOWN); if (TempBlock.isTempBlock(fallBlock) && (fallBlock.getType().equals(Material.ICE))) { return true; - } else if (WaterAbility.isWaterbendable(block, player) && !WaterAbility.isPlant(block)) { + } else if (WaterAbility.isWaterbendable(player, null, block) && !WaterAbility.isPlant(block)) { return true; } else if (fallBlock.getType() == Material.AIR) { return true; - } else if ((WaterAbility.isWaterbendable(fallBlock, player) && !WaterAbility.isPlant(fallBlock)) || fallBlock.getType() == Material.SNOW_BLOCK) { + } else if ((WaterAbility.isWaterbendable(player, null, fallBlock) && !WaterAbility.isPlant(fallBlock)) || fallBlock.getType() == Material.SNOW_BLOCK) { return true; } return false; diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterSourceGrabber.java b/src/com/projectkorra/projectkorra/waterbending/WaterSourceGrabber.java index ac29e9c2..eee1a00b 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterSourceGrabber.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterSourceGrabber.java @@ -55,7 +55,7 @@ public class WaterSourceGrabber { currentLoc.add(0, animimationSpeed * Math.signum(locDiff), 0); Block block = currentLoc.getBlock(); - if (!(WaterAbility.isWaterbendable(block, player) || block.getType() == Material.AIR) + if (!(WaterAbility.isWaterbendable(player, null, block) || block.getType() == Material.AIR) || GeneralMethods.isRegionProtectedFromBuild(player, "WaterSpout", block.getLocation())) { remove(); return; @@ -73,7 +73,7 @@ public class WaterSourceGrabber { currentLoc.add(vec.normalize().multiply(animimationSpeed)); Block block = currentLoc.getBlock(); - if (!(WaterAbility.isWaterbendable(block, player) || block.getType() == Material.AIR) + if (!(WaterAbility.isWaterbendable(player, null, block) || block.getType() == Material.AIR) || GeneralMethods.isRegionProtectedFromBuild(player, "WaterManipulation", block.getLocation())) { remove(); return;