diff --git a/src/com/projectkorra/projectkorra/PKListener.java b/src/com/projectkorra/projectkorra/PKListener.java index e3eb0f18..a1c1252d 100644 --- a/src/com/projectkorra/projectkorra/PKListener.java +++ b/src/com/projectkorra/projectkorra/PKListener.java @@ -15,6 +15,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Statistic; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -297,13 +298,16 @@ public class PKListener implements Listener { } Block block = event.getBlock(); - event.setCancelled(!WaterManipulation.canPhysicsChange(block)); - event.setCancelled(!EarthPassive.canPhysicsChange(block)); - if (!event.isCancelled()) { - event.setCancelled(Illumination.getBlocks().containsKey(block)); + + if (!WaterManipulation.canPhysicsChange(block) || !EarthPassive.canPhysicsChange(block) + || Illumination.getBlocks().containsKey(block) || EarthAbility.getPreventPhysicsBlocks().contains(block)) { + event.setCancelled(true); } - if (!event.isCancelled()) { - event.setCancelled(EarthAbility.getPreventPhysicsBlocks().contains(block)); + + //If there is a TempBlock of Air bellow FallingSand blocks, prevent it from updating. + if (!event.isCancelled() && (block.getType() == Material.SAND || block.getType() == Material.GRAVEL || block.getType() == Material.ANVIL) + && TempBlock.isTempBlock(block.getRelative(BlockFace.DOWN)) && block.getRelative(BlockFace.DOWN).getType() == Material.AIR) { + event.setCancelled(true); } } @@ -313,7 +317,8 @@ public class PKListener implements Listener { return; } Player player = event.getPlayer(); - if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) { + if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) + || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) { event.setCancelled(true); } } @@ -1410,7 +1415,12 @@ public class PKListener implements Listener { BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); int slot = event.getNewSlot() + 1; - GeneralMethods.displayMovePreview(player, CoreAbility.getAbility(bPlayer.getAbilities().get(slot))); + if (bPlayer.getAbilities().get(slot) != null ) { + CoreAbility ability = CoreAbility.getAbility(bPlayer.getAbilities().get(slot)); + if (ability != null) { + GeneralMethods.displayMovePreview(player, ability); + } + } WaterArms waterArms = CoreAbility.getAbility(player, WaterArms.class); if (waterArms != null) { diff --git a/src/com/projectkorra/projectkorra/ability/EarthAbility.java b/src/com/projectkorra/projectkorra/ability/EarthAbility.java index 6fb19346..d65372e9 100644 --- a/src/com/projectkorra/projectkorra/ability/EarthAbility.java +++ b/src/com/projectkorra/projectkorra/ability/EarthAbility.java @@ -455,7 +455,6 @@ public abstract class EarthAbility extends ElementalAbility { @SuppressWarnings("deprecation") public static void moveEarthBlock(Block source, Block target) { - byte full = 0x0; Information info; if (MOVED_EARTH.containsKey(source)) { @@ -470,12 +469,8 @@ public abstract class EarthAbility extends ElementalAbility { info.setTime(System.currentTimeMillis()); MOVED_EARTH.put(target, info); - if (GeneralMethods.isAdjacentToThreeOrMoreSources(source)) { - source.setType(Material.WATER); - source.setData(full); - } else { - source.setType(Material.AIR); - } + source.setType(Material.AIR); + if (info.getState().getType() == Material.SAND) { if (info.getState().getRawData() == (byte) 0x1) { target.setType(Material.RED_SANDSTONE); diff --git a/src/com/projectkorra/projectkorra/ability/WaterAbility.java b/src/com/projectkorra/projectkorra/ability/WaterAbility.java index c0d74ed0..2391746a 100644 --- a/src/com/projectkorra/projectkorra/ability/WaterAbility.java +++ b/src/com/projectkorra/projectkorra/ability/WaterAbility.java @@ -199,7 +199,7 @@ public abstract class WaterAbility extends ElementalAbility { for (double i = 0; i <= range; i++) { Block block = location.clone().add(vector.clone().multiply(i)).getBlock(); - if ((!isTransparent(player, block) && !isIce(block)) || GeneralMethods.isRegionProtectedFromBuild(player, "WaterManipulation", location)) { + if ((!isTransparent(player, block) && !isIce(block) && !isPlant(block)) || GeneralMethods.isRegionProtectedFromBuild(player, "WaterManipulation", location)) { continue; } else if (isWaterbendable(player, null, block) && (!isPlant(block) || plantbending)) { if (TempBlock.isTempBlock(block)) { diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java b/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java index 7eb90e9b..f7fad93d 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java @@ -108,10 +108,9 @@ public class EarthBlast extends EarthAbility { } else { sourceBlock.setType(Material.SANDSTONE); } - } if (sourceBlock.getType() == Material.STEP) { - sourceBlock.setType(Material.STEP); - sourceType = Material.STEP; - + } else if (sourceBlock.getType() == Material.STEP) { + sourceBlock.setType(Material.STEP); + sourceType = Material.STEP; } else if (sourceBlock.getType() == Material.STONE) { sourceBlock.setType(Material.COBBLESTONE); sourceType = Material.STONE; diff --git a/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java b/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java index e38aae38..e72cfd10 100644 --- a/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java +++ b/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java @@ -9,6 +9,7 @@ import com.projectkorra.projectkorra.util.ClickType; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -98,8 +99,12 @@ public class RaiseEarth extends EarthAbility { } private boolean canInstantiate() { + if (location.getBlock().getRelative(BlockFace.UP).getType() == Material.STATIONARY_LAVA) { + return false; + } + for (Block block : affectedBlocks.keySet()) { - if (block.getType() == Material.AIR || ALL_AFFECTED_BLOCKS.containsKey(block)) { + if (!isEarthbendable(block) || ALL_AFFECTED_BLOCKS.containsKey(block)) { return false; } } @@ -124,7 +129,10 @@ public class RaiseEarth extends EarthAbility { time = System.currentTimeMillis(); Block block = location.getBlock(); location = location.add(direction); - moveEarth(block, direction, distance); + if (!block.isLiquid()) { + moveEarth(block, direction, distance); + } + loadAffectedBlocks(); if (location.distanceSquared(origin) >= distance * distance) { diff --git a/src/com/projectkorra/projectkorra/earthbending/Ripple.java b/src/com/projectkorra/projectkorra/earthbending/Ripple.java index 782e5e05..04ee67d1 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Ripple.java +++ b/src/com/projectkorra/projectkorra/earthbending/Ripple.java @@ -7,6 +7,7 @@ import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.util.DamageHandler; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Entity; @@ -209,7 +210,7 @@ public class Ripple extends EarthAbility { Block topblock = loc.getBlock(); Block botblock = loc.clone().add(0, -1, 0).getBlock(); - if (isTransparent(topblock) && !topblock.isLiquid() && isEarthbendable(botblock)) { + if (isTransparent(topblock) && !topblock.isLiquid() && isEarthbendable(botblock) && botblock.getType() != Material.STATIONARY_LAVA) { location = loc.clone().add(0, -1, 0); locations.add(location); break; diff --git a/src/com/projectkorra/projectkorra/util/TempBlock.java b/src/com/projectkorra/projectkorra/util/TempBlock.java index 375eae6c..48ac6119 100644 --- a/src/com/projectkorra/projectkorra/util/TempBlock.java +++ b/src/com/projectkorra/projectkorra/util/TempBlock.java @@ -39,9 +39,9 @@ public class TempBlock { instances.put(block, temp); } else { state = block.getState(); + instances.put(block, this); block.setType(newtype); block.setData(newdata); - instances.put(block, this); } if (state.getType() == Material.FIRE) state.setType(Material.AIR); diff --git a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java index 1c327eb7..5f70a02d 100644 --- a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java +++ b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java @@ -67,6 +67,7 @@ public class SurgeWall extends WaterAbility { if (wall != null) { if (wall.progressing) { wall.freezeThaw(); + return; } else if (prepare()) { wall.remove(); start(); @@ -445,6 +446,9 @@ public class SurgeWall extends WaterAbility { private void returnWater() { if (location != null) { + if (frozen) { + location.getBlock().setType(Material.WATER); + } new WaterReturn(player, location.getBlock()); } } diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterSpout.java b/src/com/projectkorra/projectkorra/waterbending/WaterSpout.java index e7b8c103..8bdf3966 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterSpout.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterSpout.java @@ -114,7 +114,7 @@ public class WaterSpout extends WaterAbility { AFFECTED_BLOCKS.remove(tb.getBlock()); tb.revertBlock(); } - if (player.isDead() || !player.isOnline() || !bPlayer.canBind(this)) { + if (player.isDead() || !player.isOnline() || !bPlayer.canBendIgnoreBindsCooldowns(this)) { remove(); return; } else {