Enum Class ConnectionSide

java.lang.Object
java.lang.Enum<ConnectionSide>
com.comphenix.protocol.events.ConnectionSide
All Implemented Interfaces:
Serializable, Comparable<ConnectionSide>, Constable

public enum ConnectionSide extends Enum<ConnectionSide>
Used to set a packet filter.
  • Enum Constant Details

    • SERVER_SIDE

      public static final ConnectionSide SERVER_SIDE
      Listen for server side packets that will invoke onPacketSending().
    • CLIENT_SIDE

      public static final ConnectionSide CLIENT_SIDE
      Listen for client side packets that will invoke onPacketReceiving().
    • BOTH

      public static final ConnectionSide BOTH
      Listen for both client and server side packets.
  • Method Details

    • values

      public static ConnectionSide[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ConnectionSide valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isForClient

      public boolean isForClient()
    • isForServer

      public boolean isForServer()
    • getSender

      public PacketType.Sender getSender()
      Retrieve the sender of this connection side.

      This is NULL for BOTH.

      Returns:
      The sender.
    • add

      public static ConnectionSide add(ConnectionSide a, ConnectionSide b)
      If both connection sides are present, return BOTH - otherwise, return the one valud connection side.

      NULL is not a valid connection side.

      Parameters:
      a - - the first connection side.
      b - - the second connection side.
      Returns:
      BOTH or the one valid side, or NULL.