Enum LEvent

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<LEvent>

    public enum LEvent
    extends java.lang.Enum<LEvent>
    This Enum defines all logic events in the main thread. All the process should be handled in ServerLogic class.
    Author:
    kong
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      CHANNEL_HANDLE
      You can handle the message sent from a connection here.
      CONNECTION_CLOSE
      When a client is disconnected from your server for any reason, you can handle it in this event.
      CONNECTION_EXCEPTION
      The exceptions occur when the server handles messages from a client.
      FORCE_PLAYER_LEAVE_ROOM
      When a player is forced to leave his current room.
      MANUALY_CLOSE_CONNECTION
      This event is called when you let the player leave by his desire.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static LEvent valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static LEvent[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • CONNECTION_CLOSE

        public static final LEvent CONNECTION_CLOSE
        When a client is disconnected from your server for any reason, you can handle it in this event.
        Return null
      • CONNECTION_EXCEPTION

        public static final LEvent CONNECTION_EXCEPTION
        The exceptions occur when the server handles messages from a client.
        • parameter[0] the connection's id in string
        • parameter[1] the connection, see Connection
        • parameter[2] the exception will occur, see Throwable
        Return null
      • MANUALY_CLOSE_CONNECTION

        public static final LEvent MANUALY_CLOSE_CONNECTION
        This event is called when you let the player leave by his desire.
        Return null
      • FORCE_PLAYER_LEAVE_ROOM

        public static final LEvent FORCE_PLAYER_LEAVE_ROOM
        When a player is forced to leave his current room. It means this player was kicked by the host or the entire room was removed.
        Return null
      • CHANNEL_HANDLE

        public static final LEvent CHANNEL_HANDLE
        You can handle the message sent from a connection here.
        • parameter[0] index: the connection's order in one player (start from 0)
        • parameter[1] the connection (can be null) that is retrieved from the corresponding channel, see Connection
        • parameter[2] the message, see TObject which is sent by its corresponding connection
        • parameter[3] the connection object which is used to assigned to a player (can be null, see Connection
        Return null
    • Method Detail

      • values

        public static LEvent[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (LEvent c : LEvent.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static LEvent valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null