Class PreLoginEvent.PreLoginComponentResult
java.lang.Object
com.velocitypowered.api.event.connection.PreLoginEvent.PreLoginComponentResult
- All Implemented Interfaces:
ResultedEvent.Result
- Enclosing class:
PreLoginEvent
public static final class PreLoginEvent.PreLoginComponentResult
extends Object
implements ResultedEvent.Result
Represents an "allowed/allowed with forced online\offline mode/denied" result with a reason
allowed for denial.
-
Method Summary
Modifier and TypeMethodDescriptionallowed()Returns a result indicating the connection will be allowed through the proxy.Denies the login with the specified reason.Returns a result indicating the connection will be allowed through the proxy, but the connection will be forced to use offline mode even when the proxy is running in online mode.Returns a result indicating the connection will be allowed through the proxy, but the connection will be forced to use online mode provided that the proxy is in offline mode.Gets the reason component shown to the player if the connection is denied.booleanReturns whether or not the event is allowed to proceed.booleanChecks if this result explicitly forces offline mode for the connection.booleanChecks if this result explicitly forces online mode for the connection.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
-
getReasonComponent
Gets the reason component shown to the player if the connection is denied.- Returns:
- the reason as a
Component, or empty if not denied
-
isOnlineModeAllowed
public boolean isOnlineModeAllowed()Checks if this result explicitly forces online mode for the connection.- Returns:
- true if online mode is forced
-
isForceOfflineMode
public boolean isForceOfflineMode()Checks if this result explicitly forces offline mode for the connection.- Returns:
- true if offline mode is forced
-
toString
-
allowed
Returns a result indicating the connection will be allowed through the proxy.- Returns:
- the allowed result
-
forceOnlineMode
Returns a result indicating the connection will be allowed through the proxy, but the connection will be forced to use online mode provided that the proxy is in offline mode. This acts similarly toallowed()on an online-mode proxy.- Returns:
- the result
-
forceOfflineMode
Returns a result indicating the connection will be allowed through the proxy, but the connection will be forced to use offline mode even when the proxy is running in online mode.- Returns:
- the result
-
denied
Denies the login with the specified reason.- Parameters:
reason- the reason for disallowing the connection- Returns:
- a new result
-