Added EXPLOSION_PRIMED event.
This commit is contained in:
parent
5d60a1bc48
commit
01ca4cc35b
@ -533,6 +533,20 @@ public abstract class Event {
|
|||||||
*/
|
*/
|
||||||
ENTITY_EXPLODE (Category.LIVING_ENTITY),
|
ENTITY_EXPLODE (Category.LIVING_ENTITY),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when an entity has made a decision to explode.
|
||||||
|
*
|
||||||
|
* Provides an opportunity to act on the entity, change the explosion radius,
|
||||||
|
* or to change the fire-spread flag.
|
||||||
|
*
|
||||||
|
* Canceling the event negates the entity's decision to explode.
|
||||||
|
* For EntityCreeper, this resets the fuse but does not kill the Entity.
|
||||||
|
* For EntityFireball and EntityTNTPrimed....?
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.entity.EntityExplodeTriggerEvent
|
||||||
|
*/
|
||||||
|
EXPLOSION_PRIMED (Category.LIVING_ENTITY),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when an entity targets another entity
|
* Called when an entity targets another entity
|
||||||
*
|
*
|
||||||
|
@ -27,6 +27,9 @@ public class EntityListener implements Listener {
|
|||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onExplosionPrimed(ExplosionPrimedEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
public void onEntityDeath(EntityDeathEvent event) {
|
public void onEntityDeath(EntityDeathEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
42
src/main/java/org/bukkit/event/entity/ExplosionPrimedEvent.java
Executable file
42
src/main/java/org/bukkit/event/entity/ExplosionPrimedEvent.java
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
package org.bukkit.event.entity;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
|
public class ExplosionPrimedEvent extends EntityEvent implements Cancellable {
|
||||||
|
private boolean cancel;
|
||||||
|
private float radius;
|
||||||
|
private boolean fire;
|
||||||
|
|
||||||
|
public ExplosionPrimedEvent(Type type, Entity what, float radius, boolean fire) {
|
||||||
|
super(type.EXPLOSION_PRIMED, what);
|
||||||
|
this.cancel = false;
|
||||||
|
this.radius = radius;
|
||||||
|
this.fire = fire;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancel) {
|
||||||
|
this.cancel = cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getRadius() {
|
||||||
|
return radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRadius(float radius) {
|
||||||
|
this.radius = radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getFire() {
|
||||||
|
return fire;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFire(boolean fire) {
|
||||||
|
this.fire = fire;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -343,6 +343,11 @@ public final class JavaPluginLoader implements PluginLoader {
|
|||||||
((EntityListener)listener).onEntityExplode( (EntityExplodeEvent)event );
|
((EntityListener)listener).onEntityExplode( (EntityExplodeEvent)event );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
case EXPLOSION_PRIMED:
|
||||||
|
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
||||||
|
((EntityListener)listener).onExplosionPrimed( (ExplosionPrimedEvent)event );
|
||||||
|
}
|
||||||
|
};
|
||||||
case ENTITY_TARGET:
|
case ENTITY_TARGET:
|
||||||
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
||||||
((EntityListener)listener).onEntityTarget( (EntityTargetEvent)event );
|
((EntityListener)listener).onEntityTarget( (EntityTargetEvent)event );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user