EntityCombustEvent

By: Taylor Kelly <tkelly910@gmail.com>
This commit is contained in:
Bukkit/Spigot 2011-01-10 06:51:10 +08:00
parent 5c0413fb45
commit 02b2e4114c
4 changed files with 41 additions and 0 deletions

View File

@ -423,6 +423,13 @@ public abstract class Event {
* @todo: add javadoc see comment
*/
ENTITY_DEATH (Category.LIVING_ENTITY),
/**
* Called when a Skeleton or Zombie catch fire due to the sun
*
* @todo: add javadoc see comment
*/
ENTITY_COMBUST (Category.LIVING_ENTITY),
/**
* VEHICLE EVENTS

View File

@ -0,0 +1,27 @@
package org.bukkit.event.entity;
import org.bukkit.Entity;
import org.bukkit.event.Cancellable;
/**
* The event when a skeleton or zombie catch on fire due to the sun.
* If the event is cancelled, the fire is stopped.
*/
public class EntityCombustEvent extends EntityEvent implements Cancellable {
private boolean cancel;
public EntityCombustEvent(Type type, Entity what) {
super(type, what);
this.cancel = false;
}
@Override
public boolean isCancelled() {
return cancel;
}
@Override
public void setCancelled(boolean cancel) {
this.cancel = cancel;
}
}

View File

@ -14,4 +14,7 @@ public class EntityListener implements Listener {
public void onEntityDamagedByEntity(EntityDamagedByEntityEvent event) {
}
public void onEntityCombust(EntityCombustEvent event) {
}
}

View File

@ -16,6 +16,7 @@ import org.bukkit.event.CustomEventListener;
import org.bukkit.event.Event;
import org.bukkit.event.Listener;
import org.bukkit.event.block.*;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamagedByBlockEvent;
import org.bukkit.event.entity.EntityDamagedByEntityEvent;
import org.bukkit.event.entity.EntityListener;
@ -179,6 +180,9 @@ public final class JavaPluginLoader implements PluginLoader {
case ENTITY_DEATH:
// TODO: ENTITY_DEATH hook
break;
case ENTITY_COMBUST:
trueListener.onEntityCombust((EntityCombustEvent)event);
break;
}
} else if (listener instanceof VehicleListener) {
VehicleListener trueListener = (VehicleListener)listener;