summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2015-03-22 19:41:58 +0000
committerThinkofdeath <thinkofdeath@spigotmc.org>2015-03-22 19:41:58 +0000
commit1f0b2e88fe5a69e151ad5a9beb34562c7bd3c468 (patch)
tree979ee2a4c98a232bc5ae0b646a6d50db28fc4a5a
parentb886a63f362f3f7f07890930b1d46b9f8ac85f13 (diff)
downloadbukkit-1f0b2e88fe5a69e151ad5a9beb34562c7bd3c468.tar
bukkit-1f0b2e88fe5a69e151ad5a9beb34562c7bd3c468.tar.gz
bukkit-1f0b2e88fe5a69e151ad5a9beb34562c7bd3c468.tar.lz
bukkit-1f0b2e88fe5a69e151ad5a9beb34562c7bd3c468.tar.xz
bukkit-1f0b2e88fe5a69e151ad5a9beb34562c7bd3c468.zip
Add BlockExplodeEvent
-rw-r--r--src/main/java/org/bukkit/event/block/BlockExplodeEvent.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java b/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java
new file mode 100644
index 00000000..5f15e299
--- /dev/null
+++ b/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<Block> blocks;
+ private float yield;
+
+ public BlockExplodeEvent(final Block what, final List<Block> 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<Block> 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;
+ }
+}