Interface AffectItemStackEvent
-
- All Superinterfaces:
Cancellable,Event
- All Known Subinterfaces:
AffectSlotEvent,ChangeInventoryEvent,ChangeInventoryEvent.Drop,ChangeInventoryEvent.Drop.Full,ChangeInventoryEvent.Drop.Single,ChangeInventoryEvent.Held,ChangeInventoryEvent.Pickup,ChangeInventoryEvent.SwapHand,ClickContainerEvent,ClickContainerEvent.Creative,ClickContainerEvent.Creative.Drop,ClickContainerEvent.Creative.Set,ClickContainerEvent.Double,ClickContainerEvent.Drag,ClickContainerEvent.Drag.Middle,ClickContainerEvent.Drag.Primary,ClickContainerEvent.Drag.Secondary,ClickContainerEvent.Drop,ClickContainerEvent.Drop.Full,ClickContainerEvent.Drop.Outside,ClickContainerEvent.Drop.Outside.Primary,ClickContainerEvent.Drop.Outside.Secondary,ClickContainerEvent.Drop.Single,ClickContainerEvent.Middle,ClickContainerEvent.NumberPress,ClickContainerEvent.Primary,ClickContainerEvent.Recipe,ClickContainerEvent.Recipe.All,ClickContainerEvent.Recipe.Single,ClickContainerEvent.Secondary,ClickContainerEvent.SelectTrade,ClickContainerEvent.Shift,ClickContainerEvent.Shift.Primary,ClickContainerEvent.Shift.Secondary,CookingEvent.ConsumeFuel,CraftItemEvent,CraftItemEvent.Craft,CraftItemEvent.Preview,EnchantItemEvent.Post,InteractContainerEvent.Close
public interface AffectItemStackEvent extends Event, Cancellable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default List<? extends Transaction<ItemStackSnapshot>>filter(Predicate<ItemStack> predicate)Applies the providedPredicateto theListofTransactions fromtransactions()such that any time thatPredicate.test(Object)returnsfalseon aTransaction, theTransactionis marked as "invalid" and will not apply post event.List<? extends Transaction<ItemStackSnapshot>>transactions()Gets a list of theTransactions for this event.-
Methods inherited from interface org.spongepowered.api.event.Cancellable
isCancelled, setCancelled
-
-
-
-
Method Detail
-
transactions
List<? extends Transaction<ItemStackSnapshot>> transactions()
Gets a list of theTransactions 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
-
filter
default List<? extends Transaction<ItemStackSnapshot>> filter(Predicate<ItemStack> predicate)
Applies the providedPredicateto theListofTransactions fromtransactions()such that any time thatPredicate.test(Object)returnsfalseon aTransaction, theTransactionis marked as "invalid" and will not apply post event.Transaction.finalReplacement()is used to construct theItemStackto pass to the predicate- Parameters:
predicate- The predicate to use for filtering- Returns:
- The transactions for which the predicate returned
false
-
-