From ee31e221aed4def4a9b3cb61a399910e3ea933f3 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sun, 22 Mar 2015 19:41:58 +0000 Subject: [PATCH] Add BlockExplodeEvent By: Thinkofdeath --- .../bukkit/event/block/BlockExplodeEvent.java | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 paper-api/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java diff --git a/paper-api/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java b/paper-api/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java new file mode 100644 index 000000000..5f15e299e --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java @@ -0,0 +1,69 @@ +package org.bukkit.event.block; + +import org.bukkit.block.Block; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +import java.util.List; + +/** + * Called when a block explodes + */ +public class BlockExplodeEvent extends BlockEvent implements Cancellable { + private static final HandlerList handlers = new HandlerList(); + private boolean cancel; + private final List blocks; + private float yield; + + public BlockExplodeEvent(final Block what, final List blocks, final float yield) { + super(what); + this.blocks = blocks; + this.yield = yield; + this.cancel = false; + } + + 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. + * + * @return All blown-up blocks + */ + public List blockList() { + return blocks; + } + + /** + * Returns the percentage of blocks to drop from this explosion + * + * @return The yield. + */ + public float getYield() { + return yield; + } + + /** + * Sets the percentage of blocks to drop from this explosion + * + * @param yield The new yield percentage + */ + public void setYield(float yield) { + this.yield = yield; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } +}