mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 01:06:01 +01:00
Add BlockExplodeEvent
By: Thinkofdeath <thinkofdeath@spigotmc.org>
This commit is contained in:
parent
e652353b04
commit
ee31e221ae
1 changed files with 69 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue