Class PacketAdapter.AdapterParameteters

java.lang.Object
com.comphenix.protocol.events.PacketAdapter.AdapterParameteters
Enclosing class:
PacketAdapter

public static class PacketAdapter.AdapterParameteters extends Object
Represents a builder for passing parameters to the packet adapter constructor.

Note: Never make spelling mistakes in a public API!

  • Constructor Details

    • AdapterParameteters

      public AdapterParameteters()
  • Method Details

    • plugin

      public PacketAdapter.AdapterParameteters plugin(@Nonnull org.bukkit.plugin.Plugin plugin)
      Set the plugin that spawned this listener. This parameter is required.
      Parameters:
      plugin - - the plugin.
      Returns:
      This builder, for chaining.
    • connectionSide

      public PacketAdapter.AdapterParameteters connectionSide(@Nonnull ConnectionSide connectionSide)
      Set the packet types this listener is looking for. This parameter is required.
      Parameters:
      connectionSide - - the new packet type.
      Returns:
      This builder, for chaining.
    • clientSide

      public PacketAdapter.AdapterParameteters clientSide()
      Set this adapter to also look for client-side packets.
      Returns:
      This builder, for chaining.
    • serverSide

      public PacketAdapter.AdapterParameteters serverSide()
      Set this adapter to also look for server-side packets.
      Returns:
      This builder, for chaining.
    • listenerPriority

      public PacketAdapter.AdapterParameteters listenerPriority(@Nonnull ListenerPriority listenerPriority)
      Set the the event priority, where the execution is in ascending order from lowest to highest.

      Default is ListenerPriority.NORMAL.

      Parameters:
      listenerPriority - - the new event priority.
      Returns:
      This builder, for chaining.
    • gamePhase

      public PacketAdapter.AdapterParameteters gamePhase(@Nonnull GamePhase gamePhase)
      Set which game phase this listener is active under. This is a hint for ProtocolLib to start intercepting login packets.

      Default is GamePhase.PLAYING, which will not intercept login packets.

      Parameters:
      gamePhase - - the new game phase.
      Returns:
      This builder, for chaining.
    • loginPhase

      public PacketAdapter.AdapterParameteters loginPhase()
      Set the game phase to GamePhase.LOGIN, allowing ProtocolLib to intercept login packets.
      Returns:
      This builder, for chaining.
    • options

      public PacketAdapter.AdapterParameteters options(@Nonnull ListenerOptions... options)
      Set listener options that decide whether or not to intercept the raw packet data as read from the network stream.

      The default is to disable this raw packet interception.

      Parameters:
      options - - every option to use.
      Returns:
      This builder, for chaining.
    • options

      public PacketAdapter.AdapterParameteters options(@Nonnull Set<? extends ListenerOptions> options)
      Set listener options that decide whether or not to intercept the raw packet data as read from the network stream.

      The default is to disable this raw packet interception.

      Parameters:
      options - - every option to use.
      Returns:
      This builder, for chaining.
    • optionAsync

      public PacketAdapter.AdapterParameteters optionAsync()
      Set the listener option to ListenerOptions.ASYNC, indicating that our outbound listener is thread safe.

      This allows ProtocolLib to perform certain optimizations.

      Returns:
      This builder, for chaining.
    • optionSync

      public PacketAdapter.AdapterParameteters optionSync()
      Set the listener option to ListenerOptions.SYNC, indicating that our inbound listener must be executed on the main server thread.
      Returns:
      This builder, for chaining.
    • types

      public PacketAdapter.AdapterParameteters types(@Nonnull PacketType... packets)
      Set the packet types the listener is looking for.

      This parameter is required.

      Parameters:
      packets - - the packet types to look for.
      Returns:
      This builder, for chaining.
    • types

      public PacketAdapter.AdapterParameteters types(@Nonnull Set<PacketType> packets)
      Set the packet types the listener is looking for.

      This parameter is required.

      Parameters:
      packets - - a set of packet types to look for.
      Returns:
      This builder, for chaining.