Skip to content

Commit

Permalink
fix NullPointerException when trying to access config classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shimell committed Apr 7, 2021
1 parent bc2ea65 commit b5901db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/main/java/uk/co/angrybee/joe/DiscordWhitelister.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ else if(configCreated)

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();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/uk/co/angrybee/joe/configs/MainConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

// 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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();
Expand Down

0 comments on commit b5901db

Please sign in to comment.