Enough fixes for the year (#568)

• Fixed Shockwave making a mess of lava (with water?)
• Fixed select range for leaves being extremely short
• Fixed EarthTunnel making a mess of sand. Sand will no longer fall when
blocks beneath it are mined out with EarthTunnel (if it reverts)
• Fixed SurgeWall (frozen) not returning water to bottles
• Fixed WaterSpout not breaking when toggling bending
• Fixed EarthBlast not selecting sand correctly
This commit is contained in:
StrangeOne101 2016-09-03 04:48:39 +12:00 committed by OmniCypher
parent e4df21b696
commit f8e5f0a861
9 changed files with 42 additions and 25 deletions

View file

@ -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) {

View file

@ -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);
}
if (info.getState().getType() == Material.SAND) {
if (info.getState().getRawData() == (byte) 0x1) {
target.setType(Material.RED_SANDSTONE);

View file

@ -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)) {

View file

@ -108,10 +108,9 @@ public class EarthBlast extends EarthAbility {
} else {
sourceBlock.setType(Material.SANDSTONE);
}
} if (sourceBlock.getType() == 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;

View file

@ -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);
if (!block.isLiquid()) {
moveEarth(block, direction, distance);
}
loadAffectedBlocks();
if (location.distanceSquared(origin) >= distance * distance) {

View file

@ -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;

View file

@ -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);

View file

@ -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());
}
}

View file

@ -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 {