Class ServerPreConnectEvent.ServerResult
java.lang.Object
com.velocitypowered.api.event.player.ServerPreConnectEvent.ServerResult
- All Implemented Interfaces:
ResultedEvent.Result
- Enclosing class:
ServerPreConnectEvent
public static class ServerPreConnectEvent.ServerResult
extends Object
implements ResultedEvent.Result
Represents the result of the
ServerPreConnectEvent.-
Method Summary
Modifier and TypeMethodDescriptionallowed(RegisteredServer server) Allows the player to connect to the specified server.denied()Returns a result that will prevent players from connecting to another server.Returns the server the player will be connected to if the result is allowed.booleanReturns whether or not the event is allowed to proceed.toString()
-
Method Details
-
isAllowed
public boolean isAllowed()Description copied from interface:ResultedEvent.ResultReturns whether or not the event is allowed to proceed. Plugins may choose to skip denied events, and the proxy will respect the result of this method.- Specified by:
isAllowedin interfaceResultedEvent.Result- Returns:
- whether or not the event is allowed to proceed
-
getServer
Returns the server the player will be connected to if the result is allowed.- Returns:
- the server to connect to, or an empty Optional if the connection is denied
-
toString
-
denied
Returns a result that will prevent players from connecting to another server. If this result is used, thenConnectionRequestBuilder.connect()'s result will have the statusConnectionRequestBuilder.Status.CONNECTION_CANCELLED.- Returns:
- a result to deny conneections
-
allowed
Allows the player to connect to the specified server.- Parameters:
server- the new server to connect to- Returns:
- a result to allow the player to connect to the specified server
-