Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 43 lines 1.2 kB view raw
1package org.bukkit.event.block; 2 3import org.bukkit.block.Block; 4import org.bukkit.entity.Player; 5import org.bukkit.event.Cancellable; 6 7/** 8 * Called when a block is broken by a player. 9 * <p/> 10 * Note: 11 * Plugins wanting to simulate a traditional block drop should set the block to air and utilise their own methods for determining 12 * what the default drop for the block being broken is and what to do about it, if anything. 13 * <p/> 14 * If a Block Break event is cancelled, the block will not break. 15 */ 16public class BlockBreakEvent extends BlockEvent implements Cancellable { 17 18 private Player player; 19 private boolean cancel; 20 21 public BlockBreakEvent(final Block theBlock, Player player) { 22 super(Type.BLOCK_BREAK, theBlock); 23 this.player = player; 24 this.cancel = false; 25 } 26 27 /** 28 * Gets the Player that is breaking the block involved in this event. 29 * 30 * @return The Player that is breaking the block involved in this event 31 */ 32 public Player getPlayer() { 33 return player; 34 } 35 36 public boolean isCancelled() { 37 return cancel; 38 } 39 40 public void setCancelled(boolean cancel) { 41 this.cancel = cancel; 42 } 43}