Package org.spongepowered.api.adventure
Class SpongeComponents
- java.lang.Object
- 
- org.spongepowered.api.adventure.SpongeComponents
 
- 
 public final class SpongeComponents extends java.lang.ObjectAdditional SpongeAPI-specific methods for working withComponents and related.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static interfaceSpongeComponents.Factory
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static ClickEventexecuteCallback(java.util.function.Consumer<CommandCause> callback)Creates a newClickEventthat will execute the given runnable on the server when clicked.static ComponentFlattenerflattener()Get aComponentFlattenerwith access to server-specific informationstatic Componentresolve(Component component, CommandCause senderContext, Audience viewer, DefaultedRegistryReference<ResolveOperation> resolver, DefaultedRegistryReference<ResolveOperation>... otherResolvers)Render a component for viewer-specific context.static Componentresolve(Component component, CommandCause senderContext, DefaultedRegistryReference<ResolveOperation> resolver, DefaultedRegistryReference<ResolveOperation>... otherResolvers)Render a component for sender-specific context.
 
- 
- 
- 
Method Detail- 
executeCallbackpublic static ClickEvent executeCallback(java.util.function.Consumer<CommandCause> callback) Creates a newClickEventthat will execute the given runnable on the server when clicked. The callback will expire after some amount of time (not particularly instantly, but not like overnight really either).- Parameters:
- callback- The callback to execute
- Returns:
- The created click event instance
 
 - 
resolve@SafeVarargs public static Component resolve(Component component, CommandCause senderContext, Audience viewer, DefaultedRegistryReference<ResolveOperation> resolver, DefaultedRegistryReference<ResolveOperation>... otherResolvers) Render a component for viewer-specific context.The viewermust refer to a single viewer, not multiple viewers, in order to gather any useful context. If an audience cannot be resolved to a single viewer, this method will behave as if no viewer had been defined.- Parameters:
- component- the component to render
- senderContext- the context to render in
- viewer- the viewer to render for
- resolver- the first resolver
- otherResolvers- any other resolvers to apply
- Returns:
- the rendered component
 
 - 
resolve@SafeVarargs public static Component resolve(Component component, CommandCause senderContext, DefaultedRegistryReference<ResolveOperation> resolver, DefaultedRegistryReference<ResolveOperation>... otherResolvers) Render a component for sender-specific context.Viewer-specific information will not be available - Parameters:
- component- the component to render
- senderContext- the context to render in
- resolver- the first resolver
- otherResolvers- any other resolvers to apply
- Returns:
- the rendered component
 
 - 
flattenerpublic static ComponentFlattener flattener() Get aComponentFlattenerwith access to server-specific informationThis flattener can be used for custom formats where translatable strings should be localized server-side. - Returns:
- The flattener
 
 
- 
 
-