Class StructureRetriever

java.lang.Object
nl.pim16aap2.animatedarchitecture.core.structures.retriever.StructureRetriever

public abstract sealed class StructureRetriever extends Object
Represents a way to retrieve structures. It may be referenced by its name, its UID, or the object(s) itself.

Once a StructureRetriever is created, it can be used to retrieve the structure(s) it references using any of the getStructure methods.

For example:

// Get the referenced structure if there is exactly 1 match.
final CompletableFuture<Optional<Structure>> result =
    structureRetriever.getStructure();

// Get the referenced structure if there is exactly 1 match that the player is an admin of.
final CompletableFuture<Optional<Structure>> result =
    structureRetriever.getStructure(player, PermissionLevel.ADMIN);

// Get the referenced structure that the player is the creator of. If there is more than 1 match, the player
// will be asked to select one (if supported).
final CompletableFuture<Optional<Structure>> result =
    structureRetriever.getStructureInteractive(player, PermissionLevel.CREATOR);

// Get all structures that match the description.
final CompletableFuture<List<Structure>> result =
    structureRetriever.getStructures();

// Get all structures that match the description and that the player is a user of.
final CompletableFuture<List<Structure>> result =
    structureRetriever.getStructures(player, PermissionLevel.USER);