use of org.spongepowered.api.block.transaction.NotificationTicket in project SpongeCommon by SpongePowered.
the class NeighborNotification method markCancelledTransactions.
@Override
public boolean markCancelledTransactions(final NotifyNeighborBlockEvent event, final ImmutableList<? extends GameTransaction<NotifyNeighborBlockEvent>> blockTransactions) {
boolean cancelledAny = false;
for (final NotificationTicket transaction : event.tickets()) {
if (!transaction.valid()) {
cancelledAny = true;
for (final GameTransaction<NotifyNeighborBlockEvent> gameTransaction : blockTransactions) {
final NeighborNotification blockTransaction = (NeighborNotification) gameTransaction;
final Vector3i position = transaction.targetPosition();
final BlockPos affectedPosition = blockTransaction.affectedPosition;
if (position.x() == affectedPosition.getX() && position.y() == affectedPosition.getY() && position.z() == affectedPosition.getZ()) {
gameTransaction.markCancelled();
}
}
}
}
return cancelledAny;
}
Aggregations