more cleanup
This commit is contained in:
parent
007b5a4c1a
commit
3d790e9d55
@ -8,9 +8,9 @@ public class Config {
|
|||||||
private static Plugin plugin;
|
private static Plugin plugin;
|
||||||
|
|
||||||
public Config(Plugin plugin) {
|
public Config(Plugin plugin) {
|
||||||
this.plugin = plugin;
|
Config.plugin = plugin;
|
||||||
}
|
}
|
||||||
public static void loadConfig() {
|
public void loadConfig() {
|
||||||
|
|
||||||
String webhookURLPath = "webhookURL";
|
String webhookURLPath = "webhookURL";
|
||||||
|
|
||||||
@ -22,10 +22,10 @@ public class Config {
|
|||||||
plugin.saveConfig();
|
plugin.saveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setValue(String path, String value) {
|
public void setValue(String path, String value) {
|
||||||
plugin.getConfig().set(path,value);
|
plugin.getConfig().set(path,value);
|
||||||
}
|
}
|
||||||
public static Object getValue(String path) {
|
public Object getValue(String path) {
|
||||||
return plugin.getConfig().get(path);
|
return plugin.getConfig().get(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package testplugin.plugin;
|
package testplugin.plugin;
|
||||||
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public final class WebhookEventLogger extends JavaPlugin {
|
public final class WebhookEventLogger extends JavaPlugin {
|
||||||
private String webhookURL;
|
private String webhookURL;
|
||||||
@ -16,13 +17,11 @@ public final class WebhookEventLogger extends JavaPlugin {
|
|||||||
|
|
||||||
config.loadConfig();
|
config.loadConfig();
|
||||||
|
|
||||||
getLogger().info("Starting");
|
|
||||||
|
|
||||||
this.webhookURL = config.getValue("webhookURL").toString();
|
this.webhookURL = config.getValue("webhookURL").toString();
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(new Events(getLogger(), this, webhookURL), this);
|
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);
|
DiscordWebhook Webhook = new DiscordWebhook(webhookURL);
|
||||||
@ -34,7 +33,7 @@ public final class WebhookEventLogger extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
Webhook.execute();
|
Webhook.execute();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
getLogger().severe(e.getStackTrace().toString());
|
getLogger().severe(Arrays.toString(e.getStackTrace()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@ -49,7 +48,7 @@ public final class WebhookEventLogger extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
Webhook.execute();
|
Webhook.execute();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
getLogger().severe(e.getStackTrace().toString());
|
getLogger().severe(Arrays.toString(e.getStackTrace()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user