Fix LavaSurge creating permanent lava

This commit is contained in:
MistPhizzle 2014-11-19 20:44:31 -05:00
parent f584ff774f
commit 8d6d7321ee
2 changed files with 11 additions and 0 deletions

View file

@ -13,6 +13,7 @@ import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -582,6 +583,13 @@ public class PKListener implements Listener {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (Paralyze.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity)) if (Paralyze.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
event.setCancelled(true); event.setCancelled(true);
if (event.getEntityType() == EntityType.FALLING_BLOCK) {
if (LavaSurge.falling.contains(entity)) {
LavaSurge.falling.remove(entity);
event.setCancelled(true);
}
}
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)

View file

@ -32,6 +32,7 @@ public class LavaSurge
public static int travelRange = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.LavaSurge.TravelRange"); public static int travelRange = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.LavaSurge.TravelRange");
public static int maxBlocks = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.LavaSurge.MaxLavaWaves"); public static int maxBlocks = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.LavaSurge.MaxLavaWaves");
public static boolean canSourceBeEarth = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Earth.LavaSurge.SourceCanBeEarth"); public static boolean canSourceBeEarth = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Earth.LavaSurge.SourceCanBeEarth");
public static List<FallingBlock> falling = new ArrayList<FallingBlock>();
public static int particleInterval = 100; public static int particleInterval = 100;
public static int fallingBlockInterval = 100; public static int fallingBlockInterval = 100;
@ -264,6 +265,7 @@ public class LavaSurge
{ {
FallingBlock fbs = player.getWorld().spawnFallingBlock(sourceBlock.getLocation().add(0, 1, 0), Material.STATIONARY_LAVA, (byte) 0); FallingBlock fbs = player.getWorld().spawnFallingBlock(sourceBlock.getLocation().add(0, 1, 0), Material.STATIONARY_LAVA, (byte) 0);
fblocks.add(fbs); fblocks.add(fbs);
falling.add(fbs);
double x = randy.nextDouble()/5; double x = randy.nextDouble()/5;
double z = randy.nextDouble()/5; double z = randy.nextDouble()/5;
@ -278,6 +280,7 @@ public class LavaSurge
if(randy.nextBoolean() && b != sourceBlock) if(randy.nextBoolean() && b != sourceBlock)
{ {
FallingBlock fb = player.getWorld().spawnFallingBlock(b.getLocation().add(new Vector(0, 1, 0)), Material.STATIONARY_LAVA, (byte) 0); FallingBlock fb = player.getWorld().spawnFallingBlock(b.getLocation().add(new Vector(0, 1, 0)), Material.STATIONARY_LAVA, (byte) 0);
falling.add(fb);
fblocks.add(fb); fblocks.add(fb);
fb.setVelocity(direction.clone().add(new Vector(randy.nextDouble()/10, 0.1, randy.nextDouble()/10)).multiply(1.2)); fb.setVelocity(direction.clone().add(new Vector(randy.nextDouble()/10, 0.1, randy.nextDouble()/10)).multiply(1.2));
fb.setDropItem(false); fb.setDropItem(false);