fix NullPointerException when trying to access config classes
This commit is contained in:
parent
bc2ea65a90
commit
b5901db6bf
|
@ -268,6 +268,12 @@ public class DiscordWhitelister extends JavaPlugin
|
||||||
|
|
||||||
public static void ConfigSetup()
|
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
|
// Run this first, as it creates the root folder if it does not exist
|
||||||
mainConfig.ConfigSetup();
|
mainConfig.ConfigSetup();
|
||||||
customPrefixConfig.ConfigSetup();
|
customPrefixConfig.ConfigSetup();
|
||||||
|
|
|
@ -11,7 +11,7 @@ import java.util.Collections;
|
||||||
|
|
||||||
// discord-whitelister.yml
|
// discord-whitelister.yml
|
||||||
public class MainConfig extends Config {
|
public class MainConfig extends Config {
|
||||||
MainConfig() {
|
public MainConfig() {
|
||||||
fileName = "discord-whitelister.yml";
|
fileName = "discord-whitelister.yml";
|
||||||
file = new File(DiscordWhitelister.getPlugin().getDataFolder(), fileName);
|
file = new File(DiscordWhitelister.getPlugin().getDataFolder(), fileName);
|
||||||
fileConfiguration = new YamlConfiguration();
|
fileConfiguration = new YamlConfiguration();
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class OnWhitelistCommandsConfig extends Config {
|
public class OnWhitelistCommandsConfig extends Config {
|
||||||
OnWhitelistCommandsConfig() {
|
public OnWhitelistCommandsConfig() {
|
||||||
fileName = "on-whitelist-commands.yml";
|
fileName = "on-whitelist-commands.yml";
|
||||||
file = new File(DiscordWhitelister.getPlugin().getDataFolder(), fileName);
|
file = new File(DiscordWhitelister.getPlugin().getDataFolder(), fileName);
|
||||||
fileConfiguration = new YamlConfiguration();
|
fileConfiguration = new YamlConfiguration();
|
||||||
|
|
Loading…
Reference in New Issue