Enum Class ConnectionProtocol

java.lang.Object
java.lang.Enum<ConnectionProtocol>
net.minecraft.network.ConnectionProtocol
All Implemented Interfaces:
Serializable, Comparable<ConnectionProtocol>, Constable

public enum ConnectionProtocol extends Enum<ConnectionProtocol>
Describes the set of packets a connection understands at a given point. A connection always starts out in state HANDSHAKING. In this state the client sends its desired protocol using
invalid reference
ClientIntentionPacket
. The server then either accepts the connection and switches to the desired protocol or it disconnects the client (for example in case of an outdated client). Each protocol has a PacketListener implementation tied to it for server and client respectively. Every packet must correspond to exactly one protocol.
  • Enum Constant Details

    • HANDSHAKING

      public static final ConnectionProtocol HANDSHAKING
      The handshake protocol. This is the initial protocol, in which the client tells the server its intention (i.e. which protocol it wants to use).
    • PLAY

      public static final ConnectionProtocol PLAY
      The play protocol. This is the main protocol that is used while "in game" and most normal packets reside in here.
    • STATUS

      public static final ConnectionProtocol STATUS
      The status protocol. This protocol is used when a client pings a server while on the multiplayer screen.
    • LOGIN

      public static final ConnectionProtocol LOGIN
      The login protocol. This is the first protocol the client switches to to join a server. It handles authentication with the mojang servers. After it is complete, the connection is switched to the PLAY protocol.
    • CONFIGURATION

      public static final ConnectionProtocol CONFIGURATION
  • Field Details

    • id

      private final String id
  • Constructor Details

    • ConnectionProtocol

      private ConnectionProtocol(String pId)
  • Method Details

    • values

      public static ConnectionProtocol[] 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 ConnectionProtocol 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
    • id

      public String id()
    • isPlay

      public boolean isPlay()
    • isConfiguration

      public boolean isConfiguration()