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:
FutureListener, ChannelFutureListener
  • Method Summary

    Modifier and Type Method Description
    static io.netty.channel.ChannelFutureListener free​(net.minecraft.network.PacketByteBuf buf)
    Returns a future listener that releases a packet byte buf when the buffer has been sent to a remote connection.
    static boolean isLocalChannel​(io.netty.channel.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.
    static <A extends io.netty.util.concurrent.Future<? super Void>,​ B extends io.netty.util.concurrent.Future<? super Void>>
    io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>>
    union​(io.netty.util.concurrent.GenericFutureListener<A> first, io.netty.util.concurrent.GenericFutureListener<B> second)
    Combines two future listeners.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • free

      public static io.netty.channel.ChannelFutureListener free​(net.minecraft.network.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​(io.netty.channel.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 io.netty.util.concurrent.Future<? super Void>,​ B extends io.netty.util.concurrent.Future<? super Void>> io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> union​(io.netty.util.concurrent.GenericFutureListener<A> first, io.netty.util.concurrent.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.