diff --git a/src/main/java/me/xginko/betterworldstats/BetterWorldStats.java b/src/main/java/me/xginko/betterworldstats/BetterWorldStats.java index 7c9f0d9..937aef8 100644 --- a/src/main/java/me/xginko/betterworldstats/BetterWorldStats.java +++ b/src/main/java/me/xginko/betterworldstats/BetterWorldStats.java @@ -48,6 +48,13 @@ public void onEnable() { logger.info(Component.text(" \\_/\\_/\\___/_| |_\\__,_|___/\\__\\__,_|\\__/__/").style(KyoriUtil.GUPPIE_GREEN_BOLD)); logger.info(Component.text(" ").style(KyoriUtil.GUPPIE_GREEN_BOLD)); + try { + getDataFolder().mkdirs(); + } catch (Throwable t) { + logger.error("Failed to create plugin folder!", t); + getServer().getPluginManager().disablePlugin(this); + } + logger.info("Loading languages"); reloadLang(); logger.info("Loading config"); diff --git a/src/main/java/me/xginko/betterworldstats/config/Config.java b/src/main/java/me/xginko/betterworldstats/config/Config.java index bbb782f..f7c5853 100644 --- a/src/main/java/me/xginko/betterworldstats/config/Config.java +++ b/src/main/java/me/xginko/betterworldstats/config/Config.java @@ -24,12 +24,7 @@ public class Config { public final double additional_spoof_filesize; public Config() throws Exception { - // Create plugin folder first if it does not exist yet - File pluginFolder = BetterWorldStats.getInstance().getDataFolder(); - if (!pluginFolder.exists() && !pluginFolder.mkdir()) - BetterWorldStats.getLog().error("Failed to create plugin folder."); - // Load config.yml with ConfigMaster - this.configFile = ConfigFile.loadConfig(new File(pluginFolder, "config.yml")); + this.configFile = ConfigFile.loadConfig(new File(BetterWorldStats.getInstance().getDataFolder(), "config.yml")); // Title this.configFile.setTitle(new Title()