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
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 Summary
ConstructorsConstructorDescriptionClientConnectEvent(SocketExchange exchange) Constructs a new ClientConnectEvent with the specified SocketExchange and SocketMapping. -
Method Summary
Modifier and TypeMethodDescriptionvoidallowWithoutMapping(boolean allowWithoutMapping) Sets whether the websocket client is allowed to connect to the server without a valid endpoint or not.@NotNull SocketExchangeGets theSocketExchangewhich stores the involved client, server and some other data.Gets aEnumMapof allRouteRegistry.EndpointMappingassociated with the client connection event.booleanChecks if the client connection event has at least one valid SocketMapping associated with it.booleanRetrieves whether the websocket client is allowed to connect without a valid endpoint or not.Methods inherited from class de.craftsblock.craftsnet.events.EventWithCancelReason
getCancelReason, hasCancelReason, setCancelReasonMethods inherited from class de.craftsblock.craftscore.event.CancellableEvent
isCancelled, setCancelledMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.craftsblock.craftsnet.events.sockets.GenericSocketEventBase
getClient, getServer
-
Constructor Details
-
ClientConnectEvent
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
Gets theSocketExchangewhich stores the involved client, server and some other data.- Specified by:
getExchangein interfaceGenericSocketEventBase- Returns:
- The
SocketExchange.
-
getMappings
Gets aEnumMapof allRouteRegistry.EndpointMappingassociated with the client connection event.- Returns:
- A
EnumMapofRouteRegistry.EndpointMappingobjects 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-trueif the client is allowed to connect without a valid endpoint,falseotherwise.
-
isAllowedWithoutMapping
public boolean isAllowedWithoutMapping()Retrieves whether the websocket client is allowed to connect without a valid endpoint or not.- Returns:
trueif the client is allowed to connect without a valid endpoint,falseotherwise.
-