[ci skip] improvement example in javadoc for DatapackRegistrar (#12122)

This commit is contained in:
Pedro
2025-02-16 15:19:42 -03:00
committed by GitHub
parent cb25c0cf31
commit 00701267c8
3 changed files with 9 additions and 6 deletions

View File

@@ -19,11 +19,13 @@ import org.jspecify.annotations.Nullable;
* is called anytime the game tries to discover datapacks at any of the
* configured locations. This means that if a datapack should stay available to the server,
* it must always be discovered whenever this event fires.
* <p>An example of a plugin loading a datapack from within it's own jar is below</p>
* <p>
* An example of a plugin loading a datapack from within its own jar is below,
* assuming the datapack is included under {@code resources/pack} folder:
* <pre>{@code
* public class YourPluginBootstrap implements PluginBootstrap {
* @Override
* public void bootstrap(BoostrapContext context) {
* public void bootstrap(BootstrapContext context) {
* final LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
* manager.registerEventHandler(LifecycleEvents.DATAPACK_DISCOVERY, event -> {
* DatapackRegistrar registrar = event.registrar();
@@ -39,6 +41,7 @@ import org.jspecify.annotations.Nullable;
* }
* }
* }</pre>
*
* @see io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents#DATAPACK_DISCOVERY
*/
@ApiStatus.NonExtendable

View File

@@ -19,7 +19,7 @@ import org.jspecify.annotations.NullMarked;
* tags only point to individual entries and not other nested tags.
* <p>
* An example of a custom enchant being registered to the vanilla
* {@code #minecraft:in_enchanting_table} tag.
* {@code #minecraft:in_enchanting_table} tag:
* <pre>{@code
* class YourBootstrapClass implements PluginBootstrap {
*
@@ -27,7 +27,7 @@ import org.jspecify.annotations.NullMarked;
*
* @Override
* public void bootstrap(BootstrapContext context) {
* LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
* final LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
* manager.registerEventHandler(LifecycleEvents.TAGS.postFlatten(RegistryKey.ENCHANTMENT), event -> {
* final PostFlattenTagRegistrar<Enchantment> registrar = event.registrar();
* registrar.addToTag(

View File

@@ -22,11 +22,11 @@ import org.jspecify.annotations.NullMarked;
* <pre>{@code
* class YourBootstrapClass implements PluginBootstrap {
*
* public static final TagKey<ItemType> AXE_PICKAXE = TagKey.create(RegistryKey.ITEM, Key.key("papermc:axe_pickaxe"));
* public static final TagKey<ItemType> AXE_PICKAXE = ItemTypeTagKeys.create(Key.key("papermc:axe_pickaxe"));
*
* @Override
* public void bootstrap(BootstrapContext context) {
* LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
* final LifecycleEventManager<BootstrapContext> manager = context.getLifecycleManager();
* manager.registerEventHandler(LifecycleEvents.TAGS.preFlatten(RegistryKey.ITEM), event -> {
* final PreFlattenTagRegistrar<ItemType> registrar = event.registrar();
* registrar.setTag(AXE_PICKAXE, Set.of(