mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-31 21:37:39 +01:00
Added EntityExplodeEvent :D
By: speakeasy <mekevin1917@gmail.com>
This commit is contained in:
parent
6ab2ec9f85
commit
4b7aafea5d
@ -445,6 +445,13 @@ public abstract class Event {
|
||||
* @todo: add javadoc see comment
|
||||
*/
|
||||
ENTITY_COMBUST (Category.LIVING_ENTITY),
|
||||
|
||||
/**
|
||||
* Called when an entity explodes, either TNT, Creeper, or Ghast Fireball
|
||||
*
|
||||
* @todo: add javadoc see comment
|
||||
*/
|
||||
ENTITY_EXPLODE (Category.LIVING_ENTITY),
|
||||
|
||||
/**
|
||||
* VEHICLE EVENTS
|
||||
|
@ -0,0 +1,39 @@
|
||||
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import java.util.List;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.Cancellable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author SpeaKeasY
|
||||
*/
|
||||
public class EntityExplodeEvent extends EntityEvent implements Cancellable {
|
||||
private boolean cancel;
|
||||
private List blocks;
|
||||
|
||||
public EntityExplodeEvent (Type type, Entity what, List<Block> blocks) {
|
||||
super(type.ENTITY_EXPLODE, what);
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@ -23,4 +23,7 @@ public class EntityListener implements Listener {
|
||||
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
}
|
||||
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.server.PluginEvent;
|
||||
@ -228,6 +229,9 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
case ENTITY_COMBUST:
|
||||
trueListener.onEntityCombust((EntityCombustEvent)event);
|
||||
break;
|
||||
case ENTITY_EXPLODE:
|
||||
trueListener.onEntityExplode((EntityExplodeEvent)event);
|
||||
break;
|
||||
}
|
||||
} else if (listener instanceof VehicleListener) {
|
||||
VehicleListener trueListener = (VehicleListener)listener;
|
||||
|
Loading…
Reference in New Issue
Block a user