From 4e3be31d197d79094f92031dea6ca0ecc321e92c Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Mon, 31 Jan 2022 14:00:00 +0100 Subject: [PATCH] Use `Plugin#getLogger` --- .../java/xyz/grasscutters/pltm/PluginTemplate.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/xyz/grasscutters/pltm/PluginTemplate.java b/src/main/java/xyz/grasscutters/pltm/PluginTemplate.java index 9bd4908..b2daed3 100644 --- a/src/main/java/xyz/grasscutters/pltm/PluginTemplate.java +++ b/src/main/java/xyz/grasscutters/pltm/PluginTemplate.java @@ -5,7 +5,6 @@ import emu.grasscutter.plugin.Plugin; import emu.grasscutter.server.event.EventHandler; import emu.grasscutter.server.event.HandlerPriority; import emu.grasscutter.server.event.player.PlayerJoinEvent; -import org.slf4j.Logger; import xyz.grasscutters.pltm.objects.PluginConfig; import java.io.*; @@ -27,8 +26,6 @@ public final class PluginTemplate extends Plugin { return instance; } - /* A proper plugin logger will be introduced in v1.0.4-dev. */ - private final Logger logger = Grasscutter.getLogger(); /* The plugin's configuration instance. */ private PluginConfig configuration; @@ -45,18 +42,18 @@ public final class PluginTemplate extends Plugin { // Load the configuration. try { if(!config.exists() && !config.createNewFile()) { - this.logger.error("Failed to create config file."); + this.getLogger().error("Failed to create config file."); } else { try (FileWriter writer = new FileWriter(config)) { InputStream configStream = this.getResource("config.json"); if(configStream == null) { - this.logger.error("Failed to save default config file."); + this.getLogger().error("Failed to save default config file."); } else { writer.write(new BufferedReader( new InputStreamReader(configStream)).lines().collect(Collectors.joining("\n")) ); writer.close(); - - this.logger.info("Saved default config file."); + + this.getLogger().info("Saved default config file."); } } } @@ -64,7 +61,7 @@ public final class PluginTemplate extends Plugin { // Put the configuration into an instance of the config class. this.configuration = Grasscutter.getGsonFactory().fromJson(new FileReader(config), PluginConfig.class); } catch (IOException exception) { - this.logger.error("Failed to create config file.", exception); + this.getLogger().error("Failed to create config file.", exception); } }