Class KickedFromServerEvent
- java.lang.Object
-
- com.velocitypowered.api.event.player.KickedFromServerEvent
-
- All Implemented Interfaces:
ResultedEvent<KickedFromServerEvent.ServerKickResult>
public final class KickedFromServerEvent extends Object implements 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 Class Description static class
KickedFromServerEvent.DisconnectPlayer
Tells the proxy to disconnect the player with the specified reason.static class
KickedFromServerEvent.Notify
Notifies the player with the specified message but does nothing else.static class
KickedFromServerEvent.RedirectPlayer
Tells the proxy to redirect the player to another server.static interface
KickedFromServerEvent.ServerKickResult
Represents the base interface forKickedFromServerEvent
results.-
Nested classes/interfaces inherited from interface com.velocitypowered.api.event.ResultedEvent
ResultedEvent.ComponentResult, ResultedEvent.GenericResult, ResultedEvent.Result
-
-
Constructor Summary
Constructors Constructor Description KickedFromServerEvent(Player player, RegisteredServer server, @Nullable Component originalReason, boolean duringServerConnect, KickedFromServerEvent.ServerKickResult result)
Creates aKickedFromServerEvent
instance.KickedFromServerEvent(Player player, RegisteredServer server, @Nullable net.kyori.text.Component originalReason, boolean duringServerConnect, KickedFromServerEvent.ServerKickResult result)
Deprecated.KickedFromServerEvent(Player player, RegisteredServer server, @Nullable net.kyori.text.Component originalReason, boolean duringServerConnect, net.kyori.text.Component fancyReason)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Optional<net.kyori.text.Component>
getOriginalReason()
Deprecated.UsegetServerKickReason()
insteadPlayer
getPlayer()
KickedFromServerEvent.ServerKickResult
getResult()
Returns the result associated with this event.RegisteredServer
getServer()
Optional<Component>
getServerKickReason()
boolean
kickedDuringLogin()
Deprecated.kickedDuringServerConnect()
has a better name and reflects the actual resultboolean
kickedDuringServerConnect()
Returns whether or not the player got kicked while connecting to another server.void
setResult(@NonNull KickedFromServerEvent.ServerKickResult result)
Sets the result of this event.
-
-
-
Constructor Detail
-
KickedFromServerEvent
@Deprecated public KickedFromServerEvent(Player player, RegisteredServer server, @Nullable net.kyori.text.Component originalReason, boolean duringServerConnect, net.kyori.text.Component fancyReason)
Deprecated.Creates aKickedFromServerEvent
instance.- 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 processfancyReason
- a fancy reason for being disconnected, used for the initial result
-
KickedFromServerEvent
@Deprecated public KickedFromServerEvent(Player player, RegisteredServer server, @Nullable net.kyori.text.Component originalReason, boolean duringServerConnect, KickedFromServerEvent.ServerKickResult result)
Deprecated.Creates aKickedFromServerEvent
instance.- 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
-
KickedFromServerEvent
public KickedFromServerEvent(Player player, RegisteredServer server, @Nullable Component originalReason, boolean duringServerConnect, KickedFromServerEvent.ServerKickResult result)
Creates aKickedFromServerEvent
instance.- 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
-
getResult
public KickedFromServerEvent.ServerKickResult getResult()
Description copied from interface:ResultedEvent
Returns the result associated with this event.- Specified by:
getResult
in interfaceResultedEvent<KickedFromServerEvent.ServerKickResult>
- Returns:
- the result of this event
-
setResult
public void setResult(@NonNull KickedFromServerEvent.ServerKickResult result)
Description copied from interface:ResultedEvent
Sets the result of this event. The result must be non-null.- Specified by:
setResult
in interfaceResultedEvent<KickedFromServerEvent.ServerKickResult>
- Parameters:
result
- the new result
-
getPlayer
public Player getPlayer()
-
getServer
public RegisteredServer getServer()
-
getOriginalReason
@Deprecated public Optional<net.kyori.text.Component> getOriginalReason()
Deprecated.UsegetServerKickReason()
insteadGets the reason the server kicked the player from the server.- 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.- Returns:
- whether or not the player got kicked
-
kickedDuringLogin
@Deprecated public boolean kickedDuringLogin()
Deprecated.kickedDuringServerConnect()
has a better name and reflects the actual resultReturns whether or not the player got kicked while logging in.- Returns:
- whether or not the player got kicked
-
-