EntityExplodeEvent keeps track of its Location.

By: Adam Tanner <adam@adamtanner.org>
This commit is contained in:
Bukkit/Spigot 2011-01-21 19:41:43 +08:00
parent 5fcc3b626c
commit 77283a97be

View File

@ -4,6 +4,7 @@ package org.bukkit.event.entity;
import java.util.List; import java.util.List;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.Location;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
/** /**
@ -12,10 +13,12 @@ import org.bukkit.event.Cancellable;
*/ */
public class EntityExplodeEvent extends EntityEvent implements Cancellable { public class EntityExplodeEvent extends EntityEvent implements Cancellable {
private boolean cancel; private boolean cancel;
private Location location;
private List blocks; 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); super(type.ENTITY_EXPLODE, what);
this.location = location;
this.cancel = false; this.cancel = false;
this.blocks = blocks; this.blocks = blocks;
} }
@ -27,7 +30,7 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable {
public void setCancelled(boolean cancel) { public void setCancelled(boolean cancel) {
this.cancel = cancel; this.cancel = cancel;
} }
/** /**
* Returns the list of blocks that would have been removed or were * Returns the list of blocks that would have been removed or were
* removed from the explosion event. * removed from the explosion event.
@ -36,4 +39,13 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable {
return blocks; 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;
}
} }