Add basic Datapack API

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
Connor Linfoot
2021-05-16 15:07:34 +01:00
parent 613ffeaeed
commit 8595225f18
10 changed files with 200 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
package io.papermc.paper.datapack;
import java.util.Collection;
import org.jetbrains.annotations.Unmodifiable;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
@NullMarked
public interface DatapackManager {
/**
* Triggers a refresh of the available and selected datapacks. This
* can find new datapacks, remove old ones, and update the metadata for
* existing datapacks. Some of these changes will only take effect
* after the next {@link org.bukkit.Server#reloadData()} or {@code /minecraft:reload}.
*/
void refreshPacks();
/**
* Gets a datapack by name. May require calling {@link #refreshPacks()} before
* to get the latest pack information.
*
* @param name the name/id of the datapack
* @return the datapack, or null if not found
*/
@Nullable Datapack getPack(String name);
/**
* Gets the available datapacks. May require calling {@link #refreshPacks()} before
* to get the latest pack information.
*
* @return all the packs known to the server
*/
@Unmodifiable Collection<Datapack> getPacks();
/**
* Gets the enabled datapacks. May require calling {@link #refreshPacks()} before
* to get the latest pack information.
*
* @return all the packs which are currently enabled
*/
@Unmodifiable Collection<Datapack> getEnabledPacks();
}