Class MinecraftTemplateManager
java.lang.Object
de.jvstvshd.necrify.common.template.MinecraftTemplateManager
- All Implemented Interfaces:
TemplateManager
-
Constructor Summary
ConstructorsConstructorDescriptionMinecraftTemplateManager(AbstractNecrifyPlugin plugin, net.kyori.adventure.text.minimessage.MiniMessage miniMessage) -
Method Summary
Modifier and TypeMethodDescription@NotNull CompletableFuture<NecrifyTemplate> createTemplate(String name) Creates a new template with the given name.@NotNull Optional<NecrifyTemplate> getTemplate(String name) Tries to retrieve a template with the given name.@NotNull Collection<? extends NecrifyTemplate> Returns a list of all currently loaded templates.@NotNull CompletableFuture<Collection<? extends NecrifyTemplate>> Loads all templates from the storage.voidremoveTemplate(String name)
-
Constructor Details
-
MinecraftTemplateManager
public MinecraftTemplateManager(AbstractNecrifyPlugin plugin, net.kyori.adventure.text.minimessage.MiniMessage miniMessage)
-
-
Method Details
-
loadTemplates
Description copied from interface:TemplateManagerLoads all templates from the storage. This action is not meant to get called often and should only be used on start-up.- Specified by:
loadTemplatesin interfaceTemplateManager- Returns:
- a
CompletableFuturecontaining all loaded templates or an error
-
getTemplate
Description copied from interface:TemplateManagerTries to retrieve a template with the given name.- Specified by:
getTemplatein interfaceTemplateManager- Parameters:
name- the name of the template- Returns:
- an
Optionalcontaining the template if it exists
-
createTemplate
Description copied from interface:TemplateManagerCreates a new template with the given name. This operation is executed asynchronously and might throw anIllegalArgumentExceptionif the name is invalid or already taken.- Specified by:
createTemplatein interfaceTemplateManager- Parameters:
name- the name of the template- Returns:
- a
CompletableFuturecontaining the created template
-
getTemplates
Description copied from interface:TemplateManagerReturns a list of all currently loaded templates. IfTemplateManager.loadTemplates()has not yet been called, this list will remain empty except newly created templates may be listed.- Specified by:
getTemplatesin interfaceTemplateManager- Returns:
- a list of all currently loaded templates
-
removeTemplate
-