Added EntityExplodeEvent :D

By: speakeasy <mekevin1917@gmail.com>
This commit is contained in:
Bukkit/Spigot 2011-01-17 22:27:48 +08:00
parent 6ab2ec9f85
commit 4b7aafea5d
4 changed files with 53 additions and 0 deletions

View File

@ -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

View File

@ -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;
}
}

View File

@ -23,4 +23,7 @@ public class EntityListener implements Listener {
public void onEntityDamage(EntityDamageEvent event) {
}
public void onEntityExplode(EntityExplodeEvent event) {
}
}

View File

@ -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;