Interface CustomDataManager


public interface CustomDataManager
An interface to load/save custom data using MapNode.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull MapNode
    loadData(@NotNull net.kyori.adventure.key.Key key)
    Loads the MapNode.
    void
    saveData(@NotNull net.kyori.adventure.key.Key key, @NotNull MapNode mapNode)
    Saves the MapNode.
    void
    visitData(@NotNull String namespace, @NotNull BiConsumer<net.kyori.adventure.key.Key,MapNode> consumer)
    Visits all MapNodes that are keyed with the specified namespace.
  • Method Details

    • loadData

      @NotNull @NotNull MapNode loadData(@NotNull @NotNull net.kyori.adventure.key.Key key) throws Exception
      Loads the MapNode.
      Parameters:
      key - the Key
      Returns:
      the saved MapNode or newly created MapNode if not exists
      Throws:
      Exception - if a storage error occurred
    • saveData

      void saveData(@NotNull @NotNull net.kyori.adventure.key.Key key, @NotNull @NotNull MapNode mapNode) throws Exception
      Saves the MapNode.
      Parameters:
      key - the Key
      mapNode - the MapNode to save
      Throws:
      Exception - if a storage error occurred
    • visitData

      void visitData(@NotNull @NotNull String namespace, @NotNull @NotNull BiConsumer<net.kyori.adventure.key.Key,MapNode> consumer) throws Exception
      Visits all MapNodes that are keyed with the specified namespace.
      Parameters:
      namespace - the namespace to get MapNode
      consumer - the BiConsumer to consume loaded MapNode with its Key
      Throws:
      Exception - if a storage error occurred
      IllegalArgumentException - if the specified namespace is invalid (it is checked by Key.checkNamespace(String))