Commits

Thinkofname authored 1f0b2e88fe5
Add BlockExplodeEvent
No tags

src/main/java/org/bukkit/event/block/BlockExplodeEvent.java

Added
1 +package org.bukkit.event.block;
2 +
3 +import org.bukkit.block.Block;
4 +import org.bukkit.event.Cancellable;
5 +import org.bukkit.event.HandlerList;
6 +
7 +import java.util.List;
8 +
9 +/**
10 + * Called when a block explodes
11 + */
12 +public class BlockExplodeEvent extends BlockEvent implements Cancellable {
13 + private static final HandlerList handlers = new HandlerList();
14 + private boolean cancel;
15 + private final List<Block> blocks;
16 + private float yield;
17 +
18 + public BlockExplodeEvent(final Block what, final List<Block> blocks, final float yield) {
19 + super(what);
20 + this.blocks = blocks;
21 + this.yield = yield;
22 + this.cancel = false;
23 + }
24 +
25 + public boolean isCancelled() {
26 + return cancel;
27 + }
28 +
29 + public void setCancelled(boolean cancel) {
30 + this.cancel = cancel;
31 + }
32 +
33 + /**
34 + * Returns the list of blocks that would have been removed or were removed
35 + * from the explosion event.
36 + *
37 + * @return All blown-up blocks
38 + */
39 + public List<Block> blockList() {
40 + return blocks;
41 + }
42 +
43 + /**
44 + * Returns the percentage of blocks to drop from this explosion
45 + *
46 + * @return The yield.
47 + */
48 + public float getYield() {
49 + return yield;
50 + }
51 +
52 + /**
53 + * Sets the percentage of blocks to drop from this explosion
54 + *
55 + * @param yield The new yield percentage
56 + */
57 + public void setYield(float yield) {
58 + this.yield = yield;
59 + }
60 +
61 + @Override
62 + public HandlerList getHandlers() {
63 + return handlers;
64 + }
65 +
66 + public static HandlerList getHandlerList() {
67 + return handlers;
68 + }
69 +}

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut