Make PluginProviderContext#getLogger return ComponentLogger, remove PluginProviderContext#getSLF4JLogger (#8921)

This commit is contained in:
Jason 2023-02-26 12:13:15 -07:00 committed by GitHub
parent fc072c0954
commit 16fc1a175e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 42 deletions

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Paper Plugins
diff --git a/build.gradle.kts b/build.gradle.kts
index 359e7bd7e3c76cec89d638f940006dc9c944f98b..f5f217a3a786bf4c95bea74c135289d12205cf7b 100644
index d54ed6f7c4fa7e287e8daf35f7ae978b5a0a0d51..5aa294bdc1251df8798709a04ce9d34c316c7a17 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -44,7 +44,7 @@ dependencies {
@ -243,18 +243,18 @@ index 0000000000000000000000000000000000000000..ea84b11e8682e73fcd563fec65e76b70
+}
diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContext.java b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContext.java
new file mode 100644
index 0000000000000000000000000000000000000000..a4467fe1ba0dc348eab681900dbcac1770963591
index 0000000000000000000000000000000000000000..8be416f01055d94b474ecc425fc0bec69a814815
--- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/bootstrap/PluginProviderContext.java
@@ -0,0 +1,53 @@
@@ -0,0 +1,44 @@
+package io.papermc.paper.plugin.bootstrap;
+
+import io.papermc.paper.plugin.configuration.PluginMeta;
+import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+import java.nio.file.Path;
+import java.util.logging.Logger;
+
+/**
+ * Represents the context provided to a {@link PluginBootstrap} during both the bootstrapping and plugin
@ -288,17 +288,8 @@ index 0000000000000000000000000000000000000000..a4467fe1ba0dc348eab681900dbcac17
+ * @return the logger instance
+ */
+ @NotNull
+ Logger getLogger();
+ ComponentLogger getLogger();
+
+ /**
+ * Provides the SLF4J logger assigned to this plugin.
+ *
+ * @return SLF4J logger
+ */
+ @NotNull
+ default org.slf4j.Logger getSLF4JLogger() {
+ return org.slf4j.LoggerFactory.getLogger(this.getLogger().getName());
+ }
+}
diff --git a/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java b/src/main/java/io/papermc/paper/plugin/configuration/PluginMeta.java
new file mode 100644