[ci skip] Use a separate interface for bootstrapping (#9267)

This commit is contained in:
Jake Potrebic
2023-06-07 08:29:28 -07:00
parent 3b2ef3a215
commit c66a18ad54
2 changed files with 70 additions and 14 deletions

View File

@@ -194,6 +194,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ void clearPermissions();
+
+}
diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java
@@ -0,0 +0,0 @@
+package io.papermc.paper.plugin.bootstrap;
+
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Represents the context provided to a {@link PluginBootstrap} during both the bootstrapping and plugin
+ * instantiation logic.
+ * A boostrap context may be used to access data or logic usually provided to {@link org.bukkit.plugin.Plugin} instances
+ * like the plugin's configuration or logger during the plugins bootstrap.
+ */
+@ApiStatus.Experimental
+@ApiStatus.NonExtendable
+public interface BootstrapContext extends PluginProviderContext {
+}
diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/PluginBootstrap.java b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginBootstrap.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
@@ -226,7 +246,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ *
+ * @param context the server provided context
+ */
+ void bootstrap(@NotNull PluginProviderContext context);
+ void bootstrap(@NotNull BootstrapContext context);
+
+ /**
+ * Called by the server to instantiate your main class.
@@ -258,7 +278,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+/**
+ * Represents the context provided to a {@link PluginBootstrap} during both the bootstrapping and plugin
+ * instanciation logic.
+ * instantiation logic.
+ * A boostrap context may be used to access data or logic usually provided to {@link org.bukkit.plugin.Plugin} instances
+ * like the plugin's configuration or logger during the plugins bootstrap.
+ */