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:
@@ -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());
|
||||
|
||||
@@ -649,6 +649,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
}
|
||||
// Paper end - spawn egg color visibility
|
||||
|
||||
// Paper start - lifecycle event API
|
||||
@Override
|
||||
public io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager<org.bukkit.plugin.Plugin> createPluginLifecycleEventManager(final org.bukkit.plugin.java.JavaPlugin plugin, final java.util.function.BooleanSupplier registrationCheck) {
|
||||
return new io.papermc.paper.plugin.lifecycle.event.PaperLifecycleEventManager<>(plugin, registrationCheck);
|
||||
}
|
||||
// Paper end - lifecycle event API
|
||||
|
||||
/**
|
||||
* This helper class represents the different NBT Tags.
|
||||
* <p>
|
||||
|
||||
Reference in New Issue
Block a user