Interface DataPackManager
public interface DataPackManager
-
Method Summary
Modifier and TypeMethodDescriptionvoid
copy
(DataPack<?> fromPack, ResourceKey from, DataPack<?> toPack, ResourceKey to) Copies a data pack entry into another data packvoid
copy
(DataPack<?> pack, ResourceKey from, ResourceKey to) Copies a data pack entry in given data packboolean
delete
(DataPack<?> pack, ResourceKey key) Deletes the data pack entry in given data pack.boolean
exists
(DataPack<?> pack, ResourceKey key) Returns whether a data pack entry exists in given data pack.<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.<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 typeLists the data pack entries of the given data pack.<T extends DataPackEntry<T>>
CompletableFuture<Optional<T>>load
(DataPack<T> pack, ResourceKey key) Loads aDataPackEntry
from given data pack.void
move
(DataPack<?> fromPack, ResourceKey from, DataPack<?> toPack, ResourceKey to) Moves a data pack entry into another data packvoid
move
(DataPack<?> pack, ResourceKey from, ResourceKey to) Moves a data pack entry in the given data packreload()
Reloads all reloadable datapacks.<T extends DataPackEntry<T>>
CompletableFuture<Boolean>save
(T entry) Saves given data pack entry.
-
Method Details
-
reload
CompletableFuture<Void> reload()Reloads all reloadable datapacks. Also causesRegisterDataPackValueEvent
to fire- Returns:
- The future when reloading is complete
-
save
Saves given data pack entry. If the datapack is reloadable the type is available afterreload()
otherwise the server will load the persisted datapack at startup.To load a world from a
WorldTemplate
useWorldManager.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
Loads aDataPackEntry
from given data pack. Returned object may not be able to interact well with the active server.- Parameters:
pack
- The data packkey
- The data pack entry key- Returns:
- The loaded DataPackEntry
-
delete
Deletes the data pack entry in given data pack.- Parameters:
pack
- The data packkey
- The data pack entry key- Returns:
- True when deleted
- Throws:
IOException
-
copy
Copies a data pack entry in given data pack- Parameters:
pack
- The data packfrom
- The data pack entry key to copy fromto
- 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 fromfrom
- The data pack entry key to copy fromtoPack
- The data pack to copy toto
- The data pack entry key to copy to- Throws:
IOException
-
move
Moves a data pack entry in the given data pack- Parameters:
pack
- The data packfrom
- The data pack entry key to move fromto
- 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 fromfrom
- The data pack entry key to move fromtoPack
- The data pack to move toto
- The data pack entry key to move to- Throws:
IOException
-
list
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 typekey
- The data pack entry key- Returns:
- The data pack containing the data pack entry
-
exists
Returns whether a data pack entry exists in given data pack.- Parameters:
pack
- The data packkey
- The data pack entry key- Returns:
- True when the data pack entry exists
-