66 lines
1.5 KiB
Java
66 lines
1.5 KiB
Java
package org.bukkit.event.entity;
|
|
|
|
import java.util.List;
|
|
import org.bukkit.block.Block;
|
|
import org.bukkit.entity.Entity;
|
|
import org.bukkit.Location;
|
|
import org.bukkit.event.Cancellable;
|
|
|
|
/**
|
|
* Called when an entity explodes
|
|
*/
|
|
public class EntityExplodeEvent extends EntityEvent implements Cancellable {
|
|
private boolean cancel;
|
|
private Location location;
|
|
private List<Block> blocks;
|
|
private float yield = 0.3F;
|
|
|
|
public EntityExplodeEvent(Entity what, Location location, List<Block> blocks) {
|
|
super(Type.ENTITY_EXPLODE, what);
|
|
this.location = location;
|
|
this.cancel = false;
|
|
this.blocks = blocks;
|
|
}
|
|
|
|
public boolean isCancelled() {
|
|
return cancel;
|
|
}
|
|
|
|
public void setCancelled(boolean cancel) {
|
|
this.cancel = cancel;
|
|
}
|
|
|
|
/**
|
|
* Returns the list of blocks that would have been removed or were
|
|
* removed from the explosion event.
|
|
*/
|
|
public List<Block> blockList() {
|
|
return blocks;
|
|
}
|
|
|
|
/**
|
|
* Returns the location where the explosion happened.
|
|
* It is not possible to get this value from the Entity as
|
|
* the Entity no longer exists in the world.
|
|
*/
|
|
public Location getLocation() {
|
|
return location;
|
|
}
|
|
|
|
/**
|
|
* Returns the percentage of blocks to drop from this explosion
|
|
*
|
|
* @return
|
|
*/
|
|
public float getYield() {
|
|
return yield;
|
|
}
|
|
|
|
/**
|
|
* Sets the percentage of blocks to drop from this explosion
|
|
*/
|
|
public void setYield(float yield) {
|
|
this.yield = yield;
|
|
}
|
|
}
|