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

org.bukkit.event.block.BlockExplodeEvent 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.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 final List blocks;
  private boolean cancel;
  private float yield;

  public BlockExplodeEvent(final Block what, final List blocks, final float yield) {
    super(what);
    this.blocks = blocks;
    this.yield = yield;
    this.cancel = false;
  }

  public static HandlerList getHandlerList() {
    return handlers;
  }

  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 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;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy