Class KickedFromServerEventImpl
- java.lang.Object
-
- com.velocitypowered.api.event.player.KickedFromServerEventImpl
-
- All Implemented Interfaces:
Event,KickedFromServerEvent,ResultedEvent<KickedFromServerEvent.ServerKickResult>
public final class KickedFromServerEventImpl extends Object implements KickedFromServerEvent
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/interfaces inherited from interface com.velocitypowered.api.event.player.KickedFromServerEvent
KickedFromServerEvent.DisconnectPlayer, KickedFromServerEvent.Notify, KickedFromServerEvent.RedirectPlayer, KickedFromServerEvent.ServerKickResult
-
Nested classes/interfaces inherited from interface com.velocitypowered.api.event.ResultedEvent
ResultedEvent.ComponentResult, ResultedEvent.GenericResult, ResultedEvent.Result
-
-
Constructor Summary
Constructors Constructor Description KickedFromServerEventImpl(Player player, RegisteredServer server, @Nullable Component originalReason, boolean duringServerConnect, KickedFromServerEvent.ServerKickResult result)Creates aKickedFromServerEventinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleankickedDuringServerConnect()Returns whether or not the player got kicked while connecting to another server.Playerplayer()KickedFromServerEvent.ServerKickResultresult()Returns the result associated with this event.RegisteredServerserver()@Nullable ComponentserverKickReason()Gets the reason the server kicked the player from the server.voidsetResult(@NonNull KickedFromServerEvent.ServerKickResult result)Sets the result of this event.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.velocitypowered.api.event.player.KickedFromServerEvent
handleByConnectingToServer, handleByDisconnecting, handleByNotifying
-
-
-
-
Constructor Detail
-
KickedFromServerEventImpl
public KickedFromServerEventImpl(Player player, RegisteredServer server, @Nullable Component originalReason, boolean duringServerConnect, KickedFromServerEvent.ServerKickResult result)
Creates aKickedFromServerEventinstance.- Parameters:
player- the player affectedserver- the server the player disconnected fromoriginalReason- the reason for being kicked, optionalduringServerConnect- whether or not the player was kicked during the connection processresult- the initial result
-
-
Method Detail
-
result
public KickedFromServerEvent.ServerKickResult result()
Description copied from interface:ResultedEventReturns the result associated with this event.- Specified by:
resultin interfaceResultedEvent<KickedFromServerEvent.ServerKickResult>- Returns:
- the result of this event
-
setResult
public void setResult(@NonNull KickedFromServerEvent.ServerKickResult result)
Description copied from interface:ResultedEventSets the result of this event. The result must be non-null.- Specified by:
setResultin interfaceResultedEvent<KickedFromServerEvent.ServerKickResult>- Parameters:
result- the new result
-
player
public Player player()
- Specified by:
playerin interfaceKickedFromServerEvent
-
server
public RegisteredServer server()
- Specified by:
serverin interfaceKickedFromServerEvent
-
serverKickReason
public @Nullable Component serverKickReason()
Gets the reason the server kicked the player from the server.- Specified by:
serverKickReasonin interfaceKickedFromServerEvent- Returns:
- the server kicked the player from the server
-
kickedDuringServerConnect
public boolean kickedDuringServerConnect()
Returns whether or not the player got kicked while connecting to another server.- Specified by:
kickedDuringServerConnectin interfaceKickedFromServerEvent- Returns:
- whether or not the player got kicked
-
-