Class ClientConnectEvent

java.lang.Object
de.craftsblock.craftscore.event.Event
de.craftsblock.craftscore.event.CancellableEvent
de.craftsblock.craftsnet.events.EventWithCancelReason
de.craftsblock.craftsnet.events.sockets.ClientConnectEvent
All Implemented Interfaces:
de.craftsblock.craftscore.event.Cancellable, GenericSocketEventBase

public class ClientConnectEvent extends EventWithCancelReason implements GenericSocketEventBase
The ClientConnectEvent class represents an event related to a client connection to a socket. It extends the base EventWithCancelReason to support event cancellation.
Since:
2.1.1-SNAPSHOT
See Also:
  • Constructor Details

    • ClientConnectEvent

      public ClientConnectEvent(SocketExchange exchange)
      Constructs a new ClientConnectEvent with the specified SocketExchange and SocketMapping.
      Parameters:
      exchange - The SocketExchange object representing the socket connection and its associated data.
  • Method Details

    • getExchange

      @NotNull public @NotNull SocketExchange getExchange()
      Gets the SocketExchange which stores the involved client, server and some other data.
      Specified by:
      getExchange in interface GenericSocketEventBase
      Returns:
      The SocketExchange.
    • getMappings

      Gets a EnumMap of all RouteRegistry.EndpointMapping associated with the client connection event.
      Returns:
      A EnumMap of RouteRegistry.EndpointMapping objects representing the mapping for the socket connection.
    • hasMappings

      public boolean hasMappings()
      Checks if the client connection event has at least one valid SocketMapping associated with it.
      Returns:
      true if the event has at least one valid SocketMapping, false otherwise.
    • allowWithoutMapping

      public void allowWithoutMapping(boolean allowWithoutMapping)
      Sets whether the websocket client is allowed to connect to the server without a valid endpoint or not.
      Parameters:
      allowWithoutMapping - true if the client is allowed to connect without a valid endpoint, false otherwise.
    • isAllowedWithoutMapping

      public boolean isAllowedWithoutMapping()
      Retrieves whether the websocket client is allowed to connect without a valid endpoint or not.
      Returns:
      true if the client is allowed to connect without a valid endpoint, false otherwise.