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 17:49:38 -07:00
parent e5c2af7f5e
commit ef5bac21b2
20 changed files with 614 additions and 1 deletions

View File

@ -1062,6 +1062,11 @@ public final class CraftServer implements Server {
@Override
public void reload() {
// Paper start - lifecycle events
if (io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.blocksPluginReloading()) {
throw new IllegalStateException("A lifecycle event handler has been registered which makes reloading plugins not possible");
}
// Paper end - lifecycle events
org.spigotmc.WatchdogThread.hasStarted = false; // Paper - Disable watchdog early timeout on reload
this.reloadCount++;
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());