Interface SchematicCache
public interface SchematicCache
A cache which provides schematics based on filters or other factors.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintGet directory countgetMatchingDirectories(Player player, String dir, int count) Returns a list of matching directories.getMatchingSchematics(Player player, String name, int count) Returns a list of matching schematics.getSchematicsByDirectory(Player player, String name, String filter) If a directory matches the full name, all schematics inside this directory will be returned directly.getSchematicsByName(Player player, String name) Get a list of schematics which match a name or regexinit()Init method which will be executed when registered viaRegistry.register(Nameable, Object)booleanisReady()Returns whether the cache is ready to be used.reload()Reload the currently loaded schematics.intGet schematic countdefault voidshutdown()Called when the plugin gets shutdown and the cache is unregistered.
-
Field Details
-
STORAGE
The nameable key for the default cache
-
-
Method Details
-
init
CompletableFuture<Void> init()Init method which will be executed when registered viaRegistry.register(Nameable, Object)- Returns:
- A future which completes when the cache is ready.
-
reload
CompletableFuture<Void> reload()Reload the currently loaded schematics. This overrides the cache when the schematics are loaded.- Returns:
- A future which completes when the reload is finished.
-
getSchematicsByName
Get a list of schematics which match a name or regex- Parameters:
player- playername- name which will be parsed to a regex.- Returns:
- A brush config builder with assigned schematics.
-
getSchematicsByDirectory
If a directory matches the full name, all schematics inside this directory will be returned directly.- Parameters:
player- the player requesting the schematicsname- name of the schematic. may be a regexfilter- additional filter which may be an regex- Returns:
- all schematics inside the directory
-
getMatchingDirectories
Returns a list of matching directories.- Parameters:
player- the player requesting the schematicsdir- string for lookupcount- amount of returned directories- Returns:
- list of directory names with size of count or shorter
-
getMatchingSchematics
Returns a list of matching schematics.- Parameters:
player- the player requesting the schematicsname- string for lookupcount- amount of returned schematics- Returns:
- list of schematics names with size of count or shorter
-
schematicCount
int schematicCount()Get schematic count- Returns:
- schematic count
-
directoryCount
int directoryCount()Get directory count- Returns:
- directory count
-
isReady
boolean isReady()Returns whether the cache is ready to be used. A cache might not be ready to be used if it is still loading, for example. A cache that is not ready might, however, be used already and can return schematics.- Returns:
- true if the cache is ready
-
shutdown
default void shutdown()Called when the plugin gets shutdown and the cache is unregistered.
-