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.ServerResult
allowed(RegisteredServer server)
Allows the player to connect to the specified server.static ServerPreConnectEvent.ServerResult
denied()
Returns a result that will prevent players from connecting to another server.Optional<RegisteredServer>
getServer()
boolean
isAllowed()
Returns whether or not the event is allowed to proceed.String
toString()
-
-
-
Method Detail
-
isAllowed
public boolean isAllowed()
Description copied from interface:ResultedEvent.Result
Returns 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:
isAllowed
in 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
-
-