Package dev.jorel.commandapi.arguments
Interface Previewable<T extends AbstractArgument<?,?,?,?>,A>
public interface Previewable<T extends AbstractArgument<?,?,?,?>,A>
An interface representing that the argument can be previewed using
Minecraft's chat preview feature. To use this, the server must have
previews-chat=true set in its server.properties file-
Method Summary
Modifier and TypeMethodDescriptionbooleanisLegacy()usePreview(boolean usePreview) Whether this argument should use the preview result as the argument value for execution.withPreview(PreviewableFunction<A> preview) Sets thePreviewableFunctionfor this argument.
-
Method Details
-
withPreview
Sets thePreviewableFunctionfor this argument. This function will run when a player requests a chat preview from the server. The function'sPreviewInfowill be populated based on the input for the relevant player that requests the chat preview.- Parameters:
preview- the function to use for chat preview generation- Returns:
- the current argument
-
getPreview
Optional<PreviewableFunction<A>> getPreview()- Returns:
- the
PreviewableFunctionfor this argument, as anOptional.
-
usePreview
Whether this argument should use the preview result as the argument value for execution. If set to true, accessing this argument inargswill return the same value generated fromwithPreview(PreviewableFunction)- Parameters:
usePreview- whether to use the preview as the value for this argument- Returns:
- the current argument
-
isLegacy
boolean isLegacy()- Returns:
- whether this argument uses legacy chat component APIs
-