Package org.bukkit.event.block

# Class BlockPhysicsEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.block.BlockEvent
org.bukkit.event.block.BlockPhysicsEvent

All Implemented Interfaces:
  `Cancellable`

public class BlockPhysicsEvent extends BlockEvent implements Cancellable
Thrown when a block physics check is called.
This event is a high frequency event, it may be called thousands of times per a second on a busy server. Plugins are advised to listen to the event with caution and only perform lightweight checks when using it.
In addition to this, cancelling the event is liable to leave the world in an inconsistent state. For example if you use the event to leave a block floating in mid air when that block has a requirement to be attached to something, there is no guarantee that the floating block will persist across server restarts or map upgrades.
Plugins should also note that where possible this event may only called for the "root" block of physics updates in order to limit event spam. Physics updates that cause other blocks to change their state may not result in an event for each of those blocks (usually adjacent). If you are concerned about monitoring these changes then you should check adjacent blocks yourself.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.bukkit.event.Event

`Event.Result`

## Field Summary

### Fields inherited from class org.bukkit.event.block.BlockEvent

`block`

## Constructor Summary

Constructors
Constructor
Description
`BlockPhysicsEvent(@NotNull Block block, @NotNull BlockData changed)`
`BlockPhysicsEvent(@NotNull Block block, @NotNull BlockData changed, @NotNull Block sourceBlock)`
`BlockPhysicsEvent(Block block, BlockData changed, int sourceX, int sourceY, int sourceZ)`
Deprecated.

## Method Summary

Modifier and Type
Method
Description
`@NotNull BlockData`
`getChangedBlockData()`
Gets the BlockData of the block that changed, causing this event.
`@NotNull Material`
`getChangedType()`
Gets the type of block that changed, causing this event.
`static @NotNull HandlerList`
`getHandlerList()`
`@NotNull HandlerList`
`getHandlers()`
`@NotNull Block`
`getSourceBlock()`
Gets the source block that triggered this event.
`boolean`
`isCancelled()`
Gets the cancellation state of this event.
`void`
`setCancelled(boolean cancel)`
Sets the cancellation state of this event.

### Methods inherited from class org.bukkit.event.block.BlockEvent

`getBlock`

### Methods inherited from class org.bukkit.event.Event

`callEvent, getEventName, isAsynchronous`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### BlockPhysicsEvent

@Deprecated public BlockPhysicsEvent(Block block, BlockData changed, int sourceX, int sourceY, int sourceZ)
Deprecated.

### BlockPhysicsEvent

public BlockPhysicsEvent(@NotNull @NotNull Block block, @NotNull @NotNull BlockData changed)

### BlockPhysicsEvent

public BlockPhysicsEvent(@NotNull @NotNull Block block, @NotNull @NotNull BlockData changed, @NotNull @NotNull Block sourceBlock)

## Method Details

### getSourceBlock

@NotNull public @NotNull Block getSourceBlock()
Gets the source block that triggered this event. Note: This will default to block if not set.

Returns:
  The source block

### getChangedType

@NotNull public @NotNull Material getChangedType()
Gets the type of block that changed, causing this event. This is the type of `BlockEvent.getBlock()` at the time of the event.

Returns:
  Changed block's type

### getChangedBlockData

@NotNull public @NotNull BlockData getChangedBlockData()
Gets the BlockData of the block that changed, causing this event. This is the BlockData of `BlockEvent.getBlock()` at the time of the event.

Returns:
  Changed block's BlockData

### isCancelled

public boolean isCancelled()
Description copied from interface: `Cancellable`
Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

Specified by:
  `isCancelled` in interface `Cancellable`
Returns:
  true if this event is cancelled

### setCancelled

public void setCancelled(boolean cancel)
Description copied from interface: `Cancellable`
Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

Specified by:
  `setCancelled` in interface `Cancellable`
Parameters:
  `cancel` - true if you wish to cancel this event

### getHandlers

@NotNull public @NotNull HandlerList getHandlers()

Specified by:
  `getHandlers` in class `Event`

### getHandlerList

@NotNull public static @NotNull HandlerList getHandlerList()