-
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6461e08
commit 0b0edc1
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |