fix NullPointerException when trying to access config classes

This commit is contained in:
Joe Shimell 2021-04-07 16:18:29 +01:00
parent bc2ea65a90
commit b5901db6bf
3 changed files with 8 additions and 2 deletions

View File

@ -268,6 +268,12 @@ public class DiscordWhitelister extends JavaPlugin
public static void ConfigSetup()
{
mainConfig = new MainConfig();
customPrefixConfig = new CustomPrefixConfig();
customMessagesConfig = new CustomMessagesConfig();
permissionsConfig = new PermissionsConfig();
onWhitelistCommandsConfig = new OnWhitelistCommandsConfig();
// Run this first, as it creates the root folder if it does not exist
mainConfig.ConfigSetup();
customPrefixConfig.ConfigSetup();

View File

@ -11,7 +11,7 @@ import java.util.Collections;
// discord-whitelister.yml
public class MainConfig extends Config {
MainConfig() {
public MainConfig() {
fileName = "discord-whitelister.yml";
file = new File(DiscordWhitelister.getPlugin().getDataFolder(), fileName);
fileConfiguration = new YamlConfiguration();

View File

@ -8,7 +8,7 @@ import java.io.IOException;
import java.util.Arrays;
public class OnWhitelistCommandsConfig extends Config {
OnWhitelistCommandsConfig() {
public OnWhitelistCommandsConfig() {
fileName = "on-whitelist-commands.yml";
file = new File(DiscordWhitelister.getPlugin().getDataFolder(), fileName);
fileConfiguration = new YamlConfiguration();