Interface DataPackManager


public interface DataPackManager
  • Method Details

    • reload

      Reloads all reloadable datapacks. Also causes RegisterDataPackValueEvent to fire
      Returns:
      The future when reloading is complete
    • save

      <T extends DataPackEntry<T>> CompletableFuture<Boolean> save(T entry)
      Saves given data pack entry. If the datapack is reloadable the type is available after reload() otherwise the server will load the persisted datapack at startup.

      To load a world from a WorldTemplate use WorldManager.loadWorld(WorldTemplate)

      Parameters:
      entry - the data pack entry to save
      Returns:
      True when the type represented by the datapack entry will be available after reloading
    • load

      <T extends DataPackEntry<T>> CompletableFuture<Optional<T>> load(DataPack<T> pack, ResourceKey key)
      Loads a DataPackEntry from given data pack. Returned object may not be able to interact well with the active server.
      Parameters:
      pack - The data pack
      key - The data pack entry key
      Returns:
      The loaded DataPackEntry
    • delete

      boolean delete(DataPack<?> pack, ResourceKey key) throws IOException
      Deletes the data pack entry in given data pack.
      Parameters:
      pack - The data pack
      key - The data pack entry key
      Returns:
      True when deleted
      Throws:
      IOException
    • copy

      void copy(DataPack<?> pack, ResourceKey from, ResourceKey to) throws IOException
      Copies a data pack entry in given data pack
      Parameters:
      pack - The data pack
      from - The data pack entry key to copy from
      to - The data pack entry key to copy to
      Throws:
      IOException
    • copy

      void copy(DataPack<?> fromPack, ResourceKey from, DataPack<?> toPack, ResourceKey to) throws IOException
      Copies a data pack entry into another data pack
      Parameters:
      fromPack - The data pack to copy from
      from - The data pack entry key to copy from
      toPack - The data pack to copy to
      to - The data pack entry key to copy to
      Throws:
      IOException
    • move

      void move(DataPack<?> pack, ResourceKey from, ResourceKey to) throws IOException
      Moves a data pack entry in the given data pack
      Parameters:
      pack - The data pack
      from - The data pack entry key to move from
      to - The data pack entry key to move to
      Throws:
      IOException
    • move

      void move(DataPack<?> fromPack, ResourceKey from, DataPack<?> toPack, ResourceKey to) throws IOException
      Moves a data pack entry into another data pack
      Parameters:
      fromPack - The data pack to move from
      from - The data pack entry key to move from
      toPack - The data pack to move to
      to - The data pack entry key to move to
      Throws:
      IOException
    • list

      List<ResourceKey> list(DataPack<?> pack)
      Lists the data pack entries of the given data pack.
      Parameters:
      pack - The data pack
      Returns:
      The data pack entries
    • find

      <T extends DataPackEntry<T>> Map<DataPack<T>,Collection<ResourceKey>> find(DataPackType<T> packType)
      Returns a map of all data pack to data pack entry keys matching the given type.
      Parameters:
      packType - The data pack type
      Returns:
      The data pack entries found by data pack
    • findPack

      <T extends DataPackEntry<T>> Optional<DataPack<T>> findPack(DataPackType<T> packType, ResourceKey key)
      Returns the data pack containing a data pack entry with given key and pack type
      Parameters:
      packType - The data pack type
      key - The data pack entry key
      Returns:
      The data pack containing the data pack entry
    • exists

      boolean exists(DataPack<?> pack, ResourceKey key)
      Returns whether a data pack entry exists in given data pack.
      Parameters:
      pack - The data pack
      key - The data pack entry key
      Returns:
      True when the data pack entry exists