EntityExplodeEvent: Add constructor that takes yeild parameter

The Ender Dragon causes blocks to explode as it flies through them.
These blocks by default do not drop any items, so the default yeild for
this explosion event is 0. Previously the event had the default value
hard-coded to 0.3F, which is inaccurate in this situation.

We derecate the constructor with no yield, as any default yield should
really be left up to the implementation to decide, not the API.
This commit is contained in:
Andrew Ardill 2011-12-07 23:56:15 +11:00
parent db33bcd1e4
commit 56f4e89e06

View File

@ -1,11 +1,12 @@
package org.bukkit.event.entity;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.Location;
import org.bukkit.event.Cancellable;
import java.util.List;
/**
* Called when an entity explodes
*/
@ -13,13 +14,19 @@ public class EntityExplodeEvent extends EntityEvent implements Cancellable {
private boolean cancel;
private Location location;
private List<Block> blocks;
private float yield = 0.3F;
private float yield;
@Deprecated
public EntityExplodeEvent(Entity what, Location location, List<Block> blocks) {
this(what, location, blocks, 0.3F);
}
public EntityExplodeEvent(Entity what, Location location, List<Block> blocks, float yield) {
super(Type.ENTITY_EXPLODE, what);
this.location = location;
this.cancel = false;
this.blocks = blocks;
this.yield = yield;
this.cancel = false;
}
public boolean isCancelled() {