Class ProxyPingEvent
java.lang.Object
com.velocitypowered.api.event.proxy.ProxyPingEvent
- All Implemented Interfaces:
ResultedEvent<ResultedEvent.GenericResult>
@AwaitingEvent
public final class ProxyPingEvent
extends Object
implements ResultedEvent<ResultedEvent.GenericResult>
This event is fired when a request for server information is sent by a remote client, or when the
server sends the MOTD and favicon to the client after a successful login. Velocity will
wait on this event to finish firing before delivering the results to the remote client, but
you are urged to handle this event as quickly as possible when handling this event due to the
amount of ping packets a client can send.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.velocitypowered.api.event.ResultedEvent
ResultedEvent.ComponentResult, ResultedEvent.GenericResult, ResultedEvent.Result
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionObtain the connection to which the corresponding ServerPing will be sent.getPing()
Get the ServerPing to send to the connection.Gets whether to avoid sending a ping response to the connection.void
setPing
(@NotNull ServerPing ping) Sets the ServerPing to send to the connection.void
setResult
(@NotNull ResultedEvent.GenericResult result) Sets whether to avoid sending a ping response to the connection.toString()
-
Constructor Details
-
ProxyPingEvent
-
-
Method Details
-
getConnection
Obtain the connection to which the corresponding ServerPing will be sent.- Returns:
- the connection that has sent the ServerPing request
-
getPing
Get the ServerPing to send to the connection.- Returns:
- the ServerPing to send
-
setPing
Sets the ServerPing to send to the connection.- Parameters:
ping
- sets the ServerPing to send
-
getResult
Gets whether to avoid sending a ping response to the connection.- Specified by:
getResult
in interfaceResultedEvent<ResultedEvent.GenericResult>
- Returns:
- if a ping response to the connection will be avoided
- API Note:
- For the ProxyPingEvent executed to obtain the MOTD for the ServerData sent to players of versions higher than 1.19.1, the cancellation of this event will have no effect.
-
setResult
Sets whether to avoid sending a ping response to the connection. This will automatically close the connection.- Specified by:
setResult
in interfaceResultedEvent<ResultedEvent.GenericResult>
- Parameters:
result
- if a ping response to the connection will be avoided- API Note:
- For the ProxyPingEvent executed to obtain the MOTD for the ServerData sent to players of versions higher than 1.19.1, the cancellation of this event will have no effect.
-
toString
-