Class DelayedCommandInputRequest<T>
- Type Parameters:
T- The type of data that is to be retrieved from the player.
Taking the AddOwner command as an example, it could be initialized using a GUI, in which case it is known who
the ICommandSender is and what the target Structure is. However, for some GUIs (e.g. Spigot), it is
not yet known who the target player is and what the desired permission level is. This class can then be used to
retrieve the additional data that is required to execute the command.
This class manages the lifecycle of delayed command input, including registration with the
DelayedCommandInputManager, sending appropriate messages to the command sender, handling timeouts, and
executing the command once input is received.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfaceThe factory interface for creatingDelayedCommandInputRequestinstances.Nested classes/interfaces inherited from class DelayedInputRequest
DelayedInputRequest.Status -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected voidcleanup()Performs cleanup when the request is completed, timed out, or cancelled.booleanprotected CompletableFuture<?> The output of the command.inthashCode()Provides the input object as input for this input request.@NonNull StringtoString()Methods inherited from class DelayedInputRequest
cancel, cancelled, completed, exceptionally, getInputResult, getStatus, set, success, timedOut
-
Method Details
-
provide
Provides the input object as input for this input request. SeeDelayedInputRequest.set(Object).If the provided input is not of the correct type as defined by
inputClass, a future containing a null value is returned to indicate incorrect input type.- Parameters:
input- The input object to provide.- Returns:
- When the input is of the correct type,
commandOutputis returned, otherwise an exception is thrown (not as a future). - Throws:
IllegalArgumentException- If the input object is not of the correct type.
-
cleanup
protected void cleanup()Performs cleanup when the request is completed, timed out, or cancelled.This method:
- Deregisters this request from the
DelayedCommandInputManager - Sends appropriate messages to the command sender about timeout or cancellation if applicable
- Overrides:
cleanupin classDelayedInputRequest<T>
- Deregisters this request from the
-
toString
- Overrides:
toStringin classDelayedInputRequest<T>
-
equals
- Overrides:
equalsin classDelayedInputRequest<T>
-
canEqual
- Overrides:
canEqualin classDelayedInputRequest<T>
-
hashCode
public int hashCode()- Overrides:
hashCodein classDelayedInputRequest<T>
-
getCommandOutput
The output of the command. SeeBaseCommand.run().
-