Add Lifecycle Event system

This event system is separate from Bukkit's event system and is
meant for managing resources across reloads and from points in the
PluginBootstrap.
This commit is contained in:
Jake Potrebic
2023-07-18 14:47:02 -07:00
parent cf77104dbc
commit eb68d0e1b5
18 changed files with 484 additions and 2 deletions
@@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable;
* <p>
* The use of {@link PluginBase} is recommended for actual Implementation
*/
public interface Plugin extends TabExecutor {
public interface Plugin extends TabExecutor, io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner { // Paper
/**
* Returns the folder that the plugin data files are located in. The
* folder may not yet exist.
@@ -224,4 +224,14 @@ public interface Plugin extends TabExecutor {
*/
@NotNull
public String getName();
// Paper start - lifecycle events
/**
* Get the lifecycle event manager for registering handlers
* for lifecycle events allowed on the {@link Plugin}.
*
* @return the lifecycle event manager
*/
io.papermc.paper.plugin.lifecycle.event.@NotNull LifecycleEventManager<Plugin> getLifecycleManager();
// Paper end - lifecycle events
}