Class ServerPreConnectEvent
- java.lang.Object
-
- com.velocitypowered.api.event.player.ServerPreConnectEvent
-
- All Implemented Interfaces:
ResultedEvent<ServerPreConnectEvent.ServerResult>
public final class ServerPreConnectEvent extends Object implements ResultedEvent<ServerPreConnectEvent.ServerResult>
This event is fired before the player connects to a server.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ServerPreConnectEvent.ServerResult
Represents the result of theServerPreConnectEvent
.-
Nested classes/interfaces inherited from interface com.velocitypowered.api.event.ResultedEvent
ResultedEvent.ComponentResult, ResultedEvent.GenericResult, ResultedEvent.Result
-
-
Constructor Summary
Constructors Constructor Description ServerPreConnectEvent(Player player, RegisteredServer originalServer)
Creates the ServerPreConnectEvent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RegisteredServer
getOriginalServer()
Returns the server that the player originally tried to connect to.Player
getPlayer()
Returns the player connecting to the server.ServerPreConnectEvent.ServerResult
getResult()
Returns the result associated with this event.void
setResult(ServerPreConnectEvent.ServerResult result)
Sets the result of this event.String
toString()
-
-
-
Constructor Detail
-
ServerPreConnectEvent
public ServerPreConnectEvent(Player player, RegisteredServer originalServer)
Creates the ServerPreConnectEvent.- Parameters:
player
- the player who is connecting to a serveroriginalServer
- the server the player was trying to connect to
-
-
Method Detail
-
getPlayer
public Player getPlayer()
Returns the player connecting to the server.- Returns:
- the player connecting to the server
-
getResult
public ServerPreConnectEvent.ServerResult getResult()
Description copied from interface:ResultedEvent
Returns the result associated with this event.- Specified by:
getResult
in interfaceResultedEvent<ServerPreConnectEvent.ServerResult>
- Returns:
- the result of this event
-
setResult
public void setResult(ServerPreConnectEvent.ServerResult result)
Description copied from interface:ResultedEvent
Sets the result of this event. The result must be non-null.- Specified by:
setResult
in interfaceResultedEvent<ServerPreConnectEvent.ServerResult>
- Parameters:
result
- the new result
-
getOriginalServer
public RegisteredServer getOriginalServer()
Returns the server that the player originally tried to connect to. To get the server the player will connect to, see theServerPreConnectEvent.ServerResult
of this event. To get the server the player is currently on when this event is fired, usePlayer.getCurrentServer()
.- Returns:
- the server that the player originally tried to connect to
-
-