mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 11:58:06 +01:00
EntityExplodeEvent keeps track of its Location.
By: Adam Tanner <adam@adamtanner.org>
This commit is contained in:
parent
5fcc3b626c
commit
77283a97be
@ -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…
Reference in New Issue
Block a user