Class BreakBlockEvent
java.lang.Object
org.bukkit.event.Event
com.sk89q.worldguard.bukkit.event.DelegateEvent
com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent
- All Implemented Interfaces:
BulkEvent
,Handleable
,org.bukkit.event.Cancellable
This event is an internal event. We do not recommend handling or throwing
this event or its subclasses as the interface is highly subject to change.
Thrown when a block is broken.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Constructor Summary
ConstructorDescriptionBreakBlockEvent
(org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.block.Block block) BreakBlockEvent
(org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.Location target, org.bukkit.Material effectiveMaterial) BreakBlockEvent
(org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.World world, List<org.bukkit.block.Block> blocks, org.bukkit.Material effectiveMaterial) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Filter the list of affected blocks with the given predicate.boolean
Filter the list of affected blocks with the given predicate.List
<org.bukkit.block.Block> Get the affected blocks.org.bukkit.Material
Get the effective material of the block, regardless of what the block currently is.org.bukkit.event.Event.Result
Get the actual result.static org.bukkit.event.HandlerList
org.bukkit.event.HandlerList
org.bukkit.event.Event.Result
org.bukkit.World
getWorld()
Get the world.Methods inherited from class com.sk89q.worldguard.bukkit.event.DelegateEvent
getCause, getOriginalEvent, getRelevantFlags, isCancelled, isSilent, setAllowed, setCancelled, setResult, setSilent
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
BreakBlockEvent
-
BreakBlockEvent
public BreakBlockEvent(@Nullable org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.block.Block block) -
BreakBlockEvent
public BreakBlockEvent(@Nullable org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.Location target, org.bukkit.Material effectiveMaterial)
-
-
Method Details
-
getHandlers
public org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlers
in classorg.bukkit.event.Event
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList() -
getWorld
public org.bukkit.World getWorld()Get the world.- Returns:
- the world
-
getBlocks
Get the affected blocks.- Returns:
- a list of affected block
-
filter
Filter the list of affected blocks with the given predicate. If the predicate returnsfalse
, then the block is removed.- Parameters:
predicate
- the predicatecancelEventOnFalse
- true to cancel the event and clear the block list once the predicate returnsfalse
- Returns:
- true if one or more blocks were filtered out
-
filter
Filter the list of affected blocks with the given predicate. If the predicate returnsfalse
, then the block is removed.This method will not fail fast and cancel the event the first instance that the predicate returns
false
. Seefilter(Predicate, boolean)
to adjust this behavior.- Parameters:
predicate
- the predicate- Returns:
- true if one or more blocks were filtered out
-
getEffectiveMaterial
public org.bukkit.Material getEffectiveMaterial()Get the effective material of the block, regardless of what the block currently is.- Returns:
- the effective material
-
getResult
public org.bukkit.event.Event.Result getResult()- Specified by:
getResult
in interfaceHandleable
- Overrides:
getResult
in classDelegateEvent
-
getExplicitResult
public org.bukkit.event.Event.Result getExplicitResult()Description copied from interface:BulkEvent
Get the actual result.By default, bulk events will set the result to DENY if the number of affected objects drops to zero. This method returns the true result.
- Specified by:
getExplicitResult
in interfaceBulkEvent
- Returns:
- the explicit result
-