CustomExplosion & explosion/Explosion.java: Add option to use falling block explosions on CustomExplosion by option in Explosion to only spawn falling blocks, not remove blocks so that CustomExplosion can handle that
This commit is contained in:
parent
2d4dcdbd8e
commit
d3e37d4578
@ -25,7 +25,6 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -303,6 +302,11 @@ public class Explosion extends MiniPlugin
|
||||
}
|
||||
|
||||
public void BlockExplosion(Collection<Block> blockSet, Location mid, boolean onlyAbove)
|
||||
{
|
||||
BlockExplosion(blockSet, mid, onlyAbove, true);
|
||||
}
|
||||
|
||||
public void BlockExplosion(Collection<Block> blockSet, Location mid, boolean onlyAbove, boolean removeBlock)
|
||||
{
|
||||
if (blockSet.isEmpty())
|
||||
return;
|
||||
@ -320,7 +324,10 @@ public class Explosion extends MiniPlugin
|
||||
|
||||
blocks.put(cur, new AbstractMap.SimpleEntry<Integer, Byte>(cur.getTypeId(), cur.getData()));
|
||||
|
||||
cur.setType(Material.AIR);
|
||||
if (removeBlock)
|
||||
{
|
||||
cur.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
//DELAY
|
||||
|
@ -45,8 +45,10 @@ public class CustomExplosion extends Explosion
|
||||
private boolean _createFire;
|
||||
private boolean _ignoreRate = true;
|
||||
private float _blockExplosionSize;
|
||||
private boolean _fallingBlockExplosion;
|
||||
private mineplex.core.explosion.Explosion _explosion;
|
||||
|
||||
public CustomExplosion(DamageManager manager, Location loc, float explosionSize, String deathCause)
|
||||
public CustomExplosion(DamageManager manager, mineplex.core.explosion.Explosion explosion, Location loc, float explosionSize, String deathCause)
|
||||
{
|
||||
super(((CraftWorld) loc.getWorld()).getHandle(), null, loc.getX(), loc.getY(), loc.getZ(), explosionSize);
|
||||
|
||||
@ -54,6 +56,7 @@ public class CustomExplosion extends Explosion
|
||||
_manager = manager;
|
||||
_damageReason = deathCause;
|
||||
_blockExplosionSize = explosionSize;
|
||||
_explosion = explosion;
|
||||
}
|
||||
|
||||
public CustomExplosion setBlockExplosionSize(float explosionSize)
|
||||
@ -70,6 +73,13 @@ public class CustomExplosion extends Explosion
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomExplosion setFallingBlockExplosion(boolean fallingBlockExplosion)
|
||||
{
|
||||
_fallingBlockExplosion = fallingBlockExplosion;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomExplosion setDamageBlocks(boolean damageBlocks)
|
||||
{
|
||||
b = damageBlocks;
|
||||
@ -282,6 +292,11 @@ public class CustomExplosion extends Explosion
|
||||
return;
|
||||
}
|
||||
|
||||
if (_fallingBlockExplosion)
|
||||
{
|
||||
_explosion.BlockExplosion(event.GetBlocks(), new Location(_world.getWorld(), posX, posY, posZ), false, false);
|
||||
}
|
||||
|
||||
Iterator iterator = this.blocks.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
|
Loading…
Reference in New Issue
Block a user