Interface KickedFromServerEvent
-
- All Superinterfaces:
Event,ResultedEvent<KickedFromServerEvent.ServerKickResult>
- All Known Implementing Classes:
KickedFromServerEventImpl
public interface KickedFromServerEvent extends ResultedEvent<KickedFromServerEvent.ServerKickResult>
Fired when a player is kicked from a server. You may either allow Velocity to kick the player (with an optional reason override) or redirect the player to a separate server. By default, Velocity will notify the user (if they are already connected to a server) or disconnect them (if they are not on a server and no other servers are available).
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classKickedFromServerEvent.DisconnectPlayerTells the proxy to disconnect the player with the specified reason.static classKickedFromServerEvent.NotifyNotifies the player with the specified message but does nothing else.static classKickedFromServerEvent.RedirectPlayerTells the proxy to redirect the player to another server.static interfaceKickedFromServerEvent.ServerKickResultRepresents the base interface forKickedFromServerEventresults.-
Nested classes/interfaces inherited from interface com.velocitypowered.api.event.ResultedEvent
ResultedEvent.ComponentResult, ResultedEvent.GenericResult, ResultedEvent.Result
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidhandleByConnectingToServer(RegisteredServer server)Handles the event by falling back on the specified server.default voidhandleByDisconnecting(Component reason)Handles the event by disconnecting the player with the specifiedreason.default voidhandleByNotifying(Component reason)Handles the event by giving the player the specifiedreason.booleankickedDuringServerConnect()Returns whether or not the player got kicked while connecting to another server.Playerplayer()RegisteredServerserver()@Nullable ComponentserverKickReason()Gets the reason the server kicked the player from the server.-
Methods inherited from interface com.velocitypowered.api.event.ResultedEvent
result, setResult
-
-
-
-
Method Detail
-
player
Player player()
-
server
RegisteredServer server()
-
serverKickReason
@Nullable Component serverKickReason()
Gets the reason the server kicked the player from the server.- Returns:
- the server kicked the player from the server
-
kickedDuringServerConnect
boolean kickedDuringServerConnect()
Returns whether or not the player got kicked while connecting to another server.- Returns:
- whether or not the player got kicked
-
handleByDisconnecting
default void handleByDisconnecting(Component reason)
Handles the event by disconnecting the player with the specifiedreason.- Parameters:
reason- the reason for disconnecting the player
-
handleByConnectingToServer
default void handleByConnectingToServer(RegisteredServer server)
Handles the event by falling back on the specified server.- Parameters:
server- the server to fall back to
-
handleByNotifying
default void handleByNotifying(Component reason)
Handles the event by giving the player the specifiedreason.- Parameters:
reason- the reason for being kicked
-
-