Package com.velocitypowered.api.event
Class ResultedEvent.ComponentResult
java.lang.Object
com.velocitypowered.api.event.ResultedEvent.ComponentResult
- All Implemented Interfaces:
ResultedEvent.Result
- Enclosing interface:
ResultedEvent<R extends ResultedEvent.Result>
public static final class ResultedEvent.ComponentResult
extends Object
implements ResultedEvent.Result
Represents an "allowed/denied" result with a reason allowed for denial.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedComponentResult(boolean status, @Nullable Component reason) Represents an allowed or denied result that may include a denial reason. -
Method Summary
Modifier and TypeMethodDescriptionallowed()Returns a result indicating the event is allowed to proceed.Returns a result indicating the event is denied, with the given reason component.Returns the denial reason component, if present.booleanReturns whether or not the event is allowed to proceed.toString()
-
Constructor Details
-
ComponentResult
Represents an allowed or denied result that may include a denial reason.- Parameters:
status- whether the result is allowedreason- the component explaining why the result was denied, ornull
-
-
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
Returns the denial reason component, if present.- Returns:
- an
Optionalcontaining the reason component if the result is denied
-
toString
-
allowed
Returns a result indicating the event is allowed to proceed.- Returns:
- an allowed
ResultedEvent.ComponentResult
-
denied
Returns a result indicating the event is denied, with the given reason component.- Parameters:
reason- the denial reason to show- Returns:
- a denied
ResultedEvent.ComponentResult - Throws:
NullPointerException- if the reason is null
-