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

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

package org.bukkit.event.block;

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;

/**
 * Thrown when a block physics check is called
 */
public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
  private static final HandlerList handlers = new HandlerList();
  private final int changed;
  private boolean cancel = false;

  /**
   * @param block   the block involved in this event
   * @param changed the changed block's type id
   * @deprecated Magic value
   */
  @Deprecated
  public BlockPhysicsEvent(final Block block, final int changed) {
    super(block);
    this.changed = changed;
  }

  public static HandlerList getHandlerList() {
    return handlers;
  }

  /**
   * Gets the type of block that changed, causing this event
   *
   * @return Changed block's type id
   * @deprecated Magic value
   */
  @Deprecated
  public int getChangedTypeId() {
    return changed;
  }

  /**
   * Gets the type of block that changed, causing this event
   *
   * @return Changed block's type
   */
  public Material getChangedType() {
    return Material.getMaterial(changed);
  }

  public boolean isCancelled() {
    return cancel;
  }

  public void setCancelled(boolean cancel) {
    this.cancel = cancel;
  }

  @Override
  public HandlerList getHandlers() {
    return handlers;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy