Skip to content

Commit

Permalink
Initial Work on Lifecycle API
Browse files Browse the repository at this point in the history
  • Loading branch information
olijeffers0n committed Feb 21, 2024
1 parent 6461e08 commit 0b0edc1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/sidebar.paper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ const paper: SidebarsConfig = {
"dev/api/scheduler",
"dev/api/plugin-messaging",
"dev/api/plugin-configs",
"dev/api/lifecycle",
"dev/api/folia-support",
"dev/api/roadmap",
],
Expand Down
31 changes: 31 additions & 0 deletions docs/paper/dev/api/lifecycle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
slug: /dev/lifecycle
description: A guide to Paper's Lifecycle API
---

# Lifecycle API

The lifecycle API can be used for lifecycle-related registration, such as commands, the Registry Modification API and other similar resources.

## LifecycleEventManager

The `LifecycleEventManager` is tied to either a `Plugin` instance or a `BootstrapContext` depending on where you access
it from. For example in your plugin's main class:

```java title="TestPlugin.java"
@Override
public void onEnable() {
LifecycleEventManager<Plugin> lifecycleManager = this.getLifecycleManager();
}
```

Or, with a bootstrapper:

```java title="TestPluginBootstrap.java"
@Override
public void bootstrap(@NotNull BootstrapContext context) {
final LifecycleEventManager<BootstrapContext> lifecycleManager = context.getLifecycleManager();
}
```

## LifecycleEvents & RegistryEvents

0 comments on commit 0b0edc1

Please sign in to comment.