EntityExplodeEvent keeps track of its Location.
This commit is contained in:
parent
3306b07b8d
commit
da167fe2f5
@ -4,6 +4,7 @@ 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;
|
||||
|
||||
/**
|
||||
@ -12,10 +13,12 @@ import org.bukkit.event.Cancellable;
|
||||
*/
|
||||
public class EntityExplodeEvent extends EntityEvent implements Cancellable {
|
||||
private boolean cancel;
|
||||
private Location location;
|
||||
private List blocks;
|
||||
|
||||
public EntityExplodeEvent (Type type, Entity what, List<Block> blocks) {
|
||||
|
||||
public EntityExplodeEvent (Type type, Entity what, Location location, List<Block> blocks) {
|
||||
super(type.ENTITY_EXPLODE, what);
|
||||
this.location = location;
|
||||
this.cancel = false;
|
||||
this.blocks = blocks;
|
||||
}
|
||||
@ -27,7 +30,7 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable {
|
||||
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.
|
||||
@ -36,4 +39,13 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user