mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-17 10:41:41 +01:00
EntityExplodeEvent keeps track of its Location.
By: Adam Tanner <adam@adamtanner.org>
This commit is contained in:
parent
5fcc3b626c
commit
77283a97be
1 changed files with 15 additions and 3 deletions
|
@ -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…
Add table
Reference in a new issue