diff --git a/src/main/java/testplugin/plugin/Config.java b/src/main/java/testplugin/plugin/Config.java index 10b37b1..022bb51 100644 --- a/src/main/java/testplugin/plugin/Config.java +++ b/src/main/java/testplugin/plugin/Config.java @@ -8,9 +8,9 @@ public class Config { private static Plugin plugin; public Config(Plugin plugin) { - this.plugin = plugin; + Config.plugin = plugin; } - public static void loadConfig() { + public void loadConfig() { String webhookURLPath = "webhookURL"; @@ -22,10 +22,10 @@ public class Config { plugin.saveConfig(); } - public static void setValue(String path, String value) { + public void setValue(String path, String value) { plugin.getConfig().set(path,value); } - public static Object getValue(String path) { + public Object getValue(String path) { return plugin.getConfig().get(path); } } diff --git a/src/main/java/testplugin/plugin/WebhookEventLogger.java b/src/main/java/testplugin/plugin/WebhookEventLogger.java index 20aeb0b..026d5b0 100644 --- a/src/main/java/testplugin/plugin/WebhookEventLogger.java +++ b/src/main/java/testplugin/plugin/WebhookEventLogger.java @@ -1,10 +1,11 @@ package testplugin.plugin; -import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.plugin.java.JavaPlugin; import java.awt.*; import java.io.IOException; +import java.util.Arrays; +import java.util.Objects; public final class WebhookEventLogger extends JavaPlugin { private String webhookURL; @@ -16,13 +17,11 @@ public final class WebhookEventLogger extends JavaPlugin { config.loadConfig(); - getLogger().info("Starting"); - this.webhookURL = config.getValue("webhookURL").toString(); getServer().getPluginManager().registerEvents(new Events(getLogger(), this, webhookURL), this); - getCommand("webhook").setExecutor(new setWebhookCommand()); + Objects.requireNonNull(getCommand("webhook")).setExecutor(new setWebhookCommand()); DiscordWebhook Webhook = new DiscordWebhook(webhookURL); @@ -34,7 +33,7 @@ public final class WebhookEventLogger extends JavaPlugin { try { Webhook.execute(); } catch (IOException e) { - getLogger().severe(e.getStackTrace().toString()); + getLogger().severe(Arrays.toString(e.getStackTrace())); } } @Override @@ -49,7 +48,7 @@ public final class WebhookEventLogger extends JavaPlugin { try { Webhook.execute(); } catch (IOException e) { - getLogger().severe(e.getStackTrace().toString()); + getLogger().severe(Arrays.toString(e.getStackTrace())); } } }