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 theServerPreConnectEvent.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ServerPreConnectEvent.ServerResultallowed(RegisteredServer server)Allows the player to connect to the specified server.static ServerPreConnectEvent.ServerResultdenied()Returns a result that will prevent players from connecting to another server.Optional<RegisteredServer>getServer()booleanisAllowed()Returns whether or not the event is allowed to proceed.StringtoString()
-
-
-
Method Detail
-
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
public Optional<RegisteredServer> getServer()
-
denied
public static ServerPreConnectEvent.ServerResult 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
public static ServerPreConnectEvent.ServerResult allowed(RegisteredServer server)
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
-
-