Class FutureListeners

java.lang.Object
net.fabricmc.fabric.api.networking.v1.FutureListeners

public final class FutureListeners extends Object
Utilities for working with netty's future listeners.
See Also:
  • Method Details

    • free

      public static ChannelFutureListener free(PacketByteBuf buf)
      Returns a future listener that releases a packet byte buf when the buffer has been sent to a remote connection.
      Parameters:
      buf - the buffer
      Returns:
      the future listener
    • isLocalChannel

      public static boolean isLocalChannel(Channel channel)
      Returns whether a netty channel performs local transportation, or if the message objects in the channel are directly passed than written to and read from a byte buf.
      Parameters:
      channel - the channel to check
      Returns:
      whether the channel is local
    • union

      public static <A extends Future<? super Void>, B extends Future<? super Void>> GenericFutureListener<? extends Future<? super Void>> union(GenericFutureListener<A> first, GenericFutureListener<B> second)
      Combines two future listeners.
      Type Parameters:
      A - the future type of the first listener, used for casting
      B - the future type of the second listener, used for casting
      Parameters:
      first - the first future listener
      second - the second future listener
      Returns:
      the combined future listener.