Class DisconnectedEvent
- Object
-
- DisconnectedEvent
-
- All Implemented Interfaces:
IEvent
public final class DisconnectedEvent extends ObjectEvent occurring when bot gets disconnected from server.
-
-
Constructor Summary
Constructors Constructor Description DisconnectedEvent​(URI serverUri, boolean remote, Integer statusCode, String reason)Initializes a new instance of the DisconnectedEvent class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>getReason()Returns a message with the reason for closing the connection, if such reason exists.URIgetServerUri()Return the URI of the server.Optional<Integer>getStatusCode()Returns a status code that indicates the reason for closing the connection, if such status code exists.booleanisRemote()Checks if closing the connection was initiated by the remote host.
-
-
-
Constructor Detail
-
DisconnectedEvent
public DisconnectedEvent​(URI serverUri, boolean remote, Integer statusCode, String reason)Initializes a new instance of the DisconnectedEvent class.- Parameters:
serverUri- is the URI of the server.remote- is a flag indicating if closing of the connection was initiated by the remote host.statusCode- is a status code that indicates the reason for closing the connection.reason- is a message with the reason for closing the connection.
-
-
Method Detail
-
isRemote
public boolean isRemote()
Checks if closing the connection was initiated by the remote host.- Returns:
trueif closing the connection was initiated by the remote host;falseotherwise.
-
getStatusCode
public Optional<Integer> getStatusCode()
Returns a status code that indicates the reason for closing the connection, if such status code exists.- Returns:
- a status code that indicates the reason for closing the connection, if such status code exists.
-
getReason
public Optional<String> getReason()
Returns a message with the reason for closing the connection, if such reason exists.- Returns:
- a message with the reason for closing the connection, if such reason exists.
-
getServerUri
public URI getServerUri()
Return the URI of the server.- Returns:
- the URI of the server.
-
-