more cleanup
This commit is contained in:
parent
007b5a4c1a
commit
3d790e9d55
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user