Undo making JavaPlugin#logger field public (#9125)

This commit is contained in:
Emily 2023-04-19 12:46:09 -03:00
parent d8b12ddb4c
commit 992e145a16
3 changed files with 18 additions and 17 deletions

View file

@ -57,4 +57,5 @@ Denery <dorofeevij@gmail.com>
Jakubk15 <jakubk15@protonmail.com> Jakubk15 <jakubk15@protonmail.com>
Redned <redned235@gmail.com> Redned <redned235@gmail.com>
Luke Chambers <consolelogluke@gmail.com> Luke Chambers <consolelogluke@gmail.com>
Emily <emilia.lopezf.1999@gmail.com>
``` ```

View file

@ -71,24 +71,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java --- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
@@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase { @@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase {
private boolean naggable = true; .orElseThrow();
private FileConfiguration newConfig = null; }
private File configFile = null; public final void init(@NotNull PluginLoader loader, @NotNull Server server, @NotNull PluginDescriptionFile description, @NotNull File dataFolder, @NotNull File file, @NotNull ClassLoader classLoader) {
- private Logger logger = null; // Paper - PluginLogger -> Logger - init(server, description, dataFolder, file, classLoader, description);
+ public Logger logger = null; // Paper - PluginLogger -> Logger, public + init(server, description, dataFolder, file, classLoader, description, com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(description));
this.pluginMeta = description;
public JavaPlugin() { }
// Paper start - public final void init(@NotNull Server server, @NotNull PluginDescriptionFile description, @NotNull File dataFolder, @NotNull File file, @NotNull ClassLoader classLoader, @Nullable io.papermc.paper.plugin.configuration.PluginMeta configuration) {
+ public final void init(@NotNull Server server, @NotNull PluginDescriptionFile description, @NotNull File dataFolder, @NotNull File file, @NotNull ClassLoader classLoader, @Nullable io.papermc.paper.plugin.configuration.PluginMeta configuration, @NotNull Logger logger) {
// Paper end
this.loader = DummyPluginLoaderImplHolder.INSTANCE; // Paper
this.server = server;
@@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase { @@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase {
this.classLoader = classLoader; this.classLoader = classLoader;
this.configFile = new File(dataFolder, "config.yml"); this.configFile = new File(dataFolder, "config.yml");
this.pluginMeta = configuration; // Paper this.pluginMeta = configuration; // Paper
- this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); // Paper - Handle plugin prefix in implementation - this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); // Paper - Handle plugin prefix in implementation
+ // Paper start + this.logger = logger; // Paper
+ if (this.logger == null) {
+ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(this.description);
+ }
+ // Paper end
} }
/** /**
@ -109,7 +109,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
pluginState = new IllegalStateException("Initial initialization"); pluginState = new IllegalStateException("Initial initialization");
this.pluginInit = javaPlugin; this.pluginInit = javaPlugin;
+ javaPlugin.logger = this.logger; // Paper - set logger - javaPlugin.init(null, org.bukkit.Bukkit.getServer(), description, dataFolder, file, this); // Paper
javaPlugin.init(null, org.bukkit.Bukkit.getServer(), description, dataFolder, file, this); // Paper + javaPlugin.init(org.bukkit.Bukkit.getServer(), description, dataFolder, file, this, description, this.logger); // Paper
} }
// Paper start

View file

@ -990,8 +990,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ File dataFolder = new File(Bukkit.getPluginsFolder(), pluginDescriptionFile.getName()); + File dataFolder = new File(Bukkit.getPluginsFolder(), pluginDescriptionFile.getName());
+ +
+ plugin.init(Bukkit.getServer(), pluginDescriptionFile, dataFolder, this.source.toFile(), this, config); + plugin.init(Bukkit.getServer(), pluginDescriptionFile, dataFolder, this.source.toFile(), this, config, this.logger);
+ plugin.logger = this.logger;
+ +
+ this.loadedJavaPlugin = plugin; + this.loadedJavaPlugin = plugin;
+ } + }