Class RichDescription
java.lang.Object
cloud.commandframework.minecraft.extras.RichDescription
- All Implemented Interfaces:
cloud.commandframework.ArgumentDescription
public final class RichDescription
extends Object
implements cloud.commandframework.ArgumentDescription
An argument description implementation that uses Adventure components.
- Since:
- 1.4.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull RichDescription
empty()
Get an empty description.@NonNull net.kyori.adventure.text.Component
Get the contents of this description.@NonNull String
Deprecated.to discourage use.boolean
isEmpty()
static @NonNull RichDescription
of(@NonNull net.kyori.adventure.text.ComponentLike contents)
Create a new rich description from the provided component.static @NonNull RichDescription
translatable(@NonNull String key)
Create a rich description pointing to a translation key.static @NonNull RichDescription
translatable(@NonNull String key, @NonNull net.kyori.adventure.text.ComponentLike @NonNull ... args)
Create a rich description pointing to a translation key.
-
Method Details
-
empty
Get an empty description.- Returns:
- the empty description
-
of
public static @NonNull RichDescription of(@NonNull net.kyori.adventure.text.ComponentLike contents)Create a new rich description from the provided component.- Parameters:
contents
- the rich contents- Returns:
- a new rich description
-
translatable
Create a rich description pointing to a translation key.- Parameters:
key
- the translation key- Returns:
- a new rich description
-
translatable
public static @NonNull RichDescription translatable(@NonNull String key, @NonNull net.kyori.adventure.text.ComponentLike @NonNull ... args)Create a rich description pointing to a translation key.- Parameters:
key
- the translation keyargs
- the arguments to use with the translation key- Returns:
- a new rich description
-
getDescription
Deprecated.to discourage use. A plain serialization is a somewhat expensive and lossy operation, usegetContents()
instead.- Specified by:
getDescription
in interfacecloud.commandframework.ArgumentDescription
-
getContents
public @NonNull net.kyori.adventure.text.Component getContents()Get the contents of this description.- Returns:
- the component contents of this description
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfacecloud.commandframework.ArgumentDescription
-