Class StructureAnimationRequestBuilder
StructureAnimationRequest instances implemented as a guided builder.
You can obtain an instance of this class using
IAnimatedArchitecturePlatform.getStructureAnimationRequestBuilder().
Example usage:
structureAnimationRequestBuilder
.builder()
.structure(structure) // Structures or their retrievers both work
.structureActionCause(StructureActionCause.PLUGIN)
.structureActionType(StructureActionType.TOGGLE)
.responsible(player)
.messageReceiver(player)
.build()
.execute()
.thenAccept(structureToggleResult -> ...)
.exceptionally(throwable -> ...);
The builder is implemented as a guided builder, which means that you can only call methods in a specific order until all required data is available. After that, there are additional options to specify optional data, such as the time the animation should take or the animation type.
One thing to note is that when the animation cause is set to StructureActionCause.PLAYER, the request
requires the responsible player to be set using the otherwise-optional StructureAnimationRequestBuilder.IBuilder.responsible(IPlayer) method.
Even when providing a responsible player, the builder allows you to specify a message receiver. This is useful when a
player is responsible for the animation, but any messages should be sent elsewhere. For example, you can ensure all
messages are only sent to the server console by using StructureAnimationRequestBuilder.IBuilder.messageReceiverServer().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interfacestatic interface -
Constructor Summary
ConstructorsConstructorDescriptionStructureAnimationRequestBuilder(StructureAnimationRequest.IFactory structureToggleRequestFactory, IMessageable messageableServer, IPlayerFactory playerFactory, IConfig config) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new guided builder for aStructureAnimationRequest.
-
Constructor Details
-
StructureAnimationRequestBuilder
@Inject public StructureAnimationRequestBuilder(StructureAnimationRequest.IFactory structureToggleRequestFactory, @Named("MessageableServer") IMessageable messageableServer, IPlayerFactory playerFactory, IConfig config)
-
-
Method Details
-
builder
Creates a new guided builder for aStructureAnimationRequest.- Returns:
- The first step of the guided builder.
-