Interface ChangeBlockEvent.All
-
- All Superinterfaces:
Cancellable
,ChangeBlockEvent
,Event
- Enclosing interface:
- ChangeBlockEvent
public static interface ChangeBlockEvent.All extends ChangeBlockEvent, Cancellable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.api.event.block.ChangeBlockEvent
ChangeBlockEvent.All, ChangeBlockEvent.Post, ChangeBlockEvent.Pre
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.List<BlockTransaction>
invalidate(java.util.function.Predicate<ServerLocation> predicate)
Applies the providedPredicate
to theList
ofTransaction
s fromtransactions()
such that any time thatPredicate.test(Object)
returnsfalse
on the location of theTransaction
, theTransaction
is marked as "invalid" and will not apply post event.default void
invalidateAll()
Invalidates the list as such that allTransaction
s are marked as "invalid" and will not apply post event.java.util.List<BlockTransaction>
transactions()
Gets a list of theTransaction
s for this event.default java.util.stream.Stream<BlockTransaction>
transactions(Operation operation)
-
Methods inherited from interface org.spongepowered.api.event.Cancellable
isCancelled, setCancelled
-
Methods inherited from interface org.spongepowered.api.event.block.ChangeBlockEvent
world
-
-
-
-
Method Detail
-
transactions
java.util.List<BlockTransaction> transactions()
Gets a list of theTransaction
s for this event. If a transaction is requested to be marked as "invalid",Transaction.setValid(boolean)
can be used.- Returns:
- The unmodifiable list of transactions
-
transactions
default java.util.stream.Stream<BlockTransaction> transactions(Operation operation)
Gets aStream
ofBlockTransactions
filtered by a particularblock operation
. The difference between this andtransactions()
is that while the general transactions is still an orderedList
, this is a filtered stream of that list, equally unmodifiable. Thetransactions
themselves are still modifiable withBlockTransaction#setCustom(BlockSnapshot)
, but altering the customized snapshot will NOT alter theOperation
being performed. As a logical perspective, there is no functional difference between any twooperations
, but it can be important to differentiate between the two in some contexts.- Parameters:
operation
- The operation being performed- Returns:
- The stream filtering on the given operation, may be empty
-
invalidate
default java.util.List<BlockTransaction> invalidate(java.util.function.Predicate<ServerLocation> predicate)
Applies the providedPredicate
to theList
ofTransaction
s fromtransactions()
such that any time thatPredicate.test(Object)
returnsfalse
on the location of theTransaction
, theTransaction
is marked as "invalid" and will not apply post event.Transaction.original()
is used to get theServerLocation
- Parameters:
predicate
- The predicate to use for filtering- Returns:
- The transactions for which the predicate returned
false
-
invalidateAll
default void invalidateAll()
Invalidates the list as such that allTransaction
s are marked as "invalid" and will not apply post event.
-
-