Class PacketType<V extends PacketView>

java.lang.Object
devs.beer.nativepackets.api.PacketType<V>
Type Parameters:
V - lazy packet view type

public final class PacketType<V extends PacketView> extends Object
Stable semantic packet type with a compact runtime index.
  • Method Details

    • create

      public static <V extends PacketView> PacketType<V> create(int index, String key, PacketDirection direction, ProtocolPhase phase, Class<V> viewType)
      Creates a generated or adapter-declared semantic packet type.
      Type Parameters:
      V - lazy packet view type
      Parameters:
      index - compact lookup index
      key - stable semantic key
      direction - packet direction
      phase - protocol phase
      viewType - lazy view contract
      Returns:
      immutable packet type
    • index

      public int index()
      Returns the compact lookup index.
      Returns:
      compact index
    • key

      public String key()
      Returns the stable semantic key.
      Returns:
      semantic key
    • direction

      public PacketDirection direction()
      Returns the declared direction.
      Returns:
      packet direction
    • phase

      public ProtocolPhase phase()
      Returns the declared phase.
      Returns:
      protocol phase
    • viewType

      public Class<V> viewType()
      Returns the lazy view contract.
      Returns:
      view type
    • toString

      public String toString()
      Overrides:
      toString in class Object