All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bukkit.event.block.BlockBreakEvent Maven / Gradle / Ivy

There is a newer version: 2.4.0
Show newest version
package org.bukkit.event.block;

import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;

/**
 * Called when a block is broken by a player.
 * 

* If you wish to have the block drop experience, you must set the experience * value above 0. By default, experience will be set in the event if: *

    *
  1. The player is not in creative or adventure mode *
  2. The player can loot the block (ie: does not destroy it completely, by * using the correct tool) *
  3. The player does not have silk touch *
  4. The block drops experience in vanilla Minecraft *
*

* Note: * Plugins wanting to simulate a traditional block drop should set the block * to air and utilize their own methods for determining what the default drop * for the block being broken is and what to do about it, if anything. *

* If a Block Break event is cancelled, the block will not break and * experience will not drop. */ public class BlockBreakEvent extends BlockExpEvent implements Cancellable { private final Player player; private boolean cancel; public BlockBreakEvent(final Block theBlock, final Player player) { super(theBlock, 0); this.player = player; } /** * Gets the Player that is breaking the block involved in this event. * * @return The Player that is breaking the block involved in this event */ public Player getPlayer() { return player; } public boolean isCancelled() { return cancel; } public void setCancelled(boolean cancel) { this.cancel = cancel; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy