Package nl.pim16aap2.animatedarchitecture.core.commands


@NonNullByDefault package nl.pim16aap2.animatedarchitecture.core.commands
This package contains command definitions and command factories used by this project, as well as various base command classes and interfaces.

Construction of new commands is handled by the CommandFactory, when can be obtained using IAnimatedArchitecturePlatform.getCommandFactory().

A command is not executed directly when it is created. To execute a command, you must call BaseCommand.run() on it. For example:


 public void setBlocksToMove(
     CommandFactory commandFactory, ICommandSender commandSender, StructureRetriever retriever, int blocksToMove)
 {
     commandFactory
         .newSetBlocksToMove(commandSender, retriever, blocksToMove)
         .run()
         .exceptionally(ex -> ...);
 }

For situations where not all required data is available, the 'Delayed' version of the command can be used. For example, when a player selects the option to change the 'blocksToMove' value of a portcullis in the GUI. In this situation, you only know the target structure, but not yet the new 'blocksToMove' value. The SetBlocksToMoveDelayed command can then be used to request the player to specify the new value.

For example:

invalid input: '{@code
 public void setBlocksToMoveDelayed(
     CommandFactory commandFactory, ICommandSender commandSender, StructureRetriever retriever)
 {
     commandFactory
         .getSetBlocksToMoveDelayed()
         .runDelayed(commandSender, retriever)
         .exceptionally(ex -> ...);
 }</pre>'