Skip to content

Commit

Permalink
make sure pluginfolder is created before everything else
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Mar 22, 2024
1 parent 1b09b23 commit 99a5f2e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ public void onEnable() {
isServerFolia = false;
}

try {
getDataFolder().mkdirs();
} catch (Exception e) {
AnarchyExploitFixes.getPrefixedLogger().trace("Failed to create plugin folder!", e);
getServer().getPluginManager().disablePlugin(this);
}

prefixedLogger.info("Loading Translations");
reloadLang();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ public class Config {
elytra_teleport_back, elytra_calculate_3D;

public Config() throws Exception {
// Create plugin folder first if it does not exist yet
File pluginFolder = AnarchyExploitFixes.getInstance().getDataFolder();
if (!pluginFolder.exists() && !pluginFolder.mkdir())
AnarchyExploitFixes.getPrefixedLogger().error("Failed to create plugin folder.");
// Load config.yml with ConfigMaster
this.config = ConfigFile.loadConfig(new File(pluginFolder, "config.yml"));
this.config = ConfigFile.loadConfig(new File(AnarchyExploitFixes.getInstance().getDataFolder(), "config.yml"));

// Pre-structure to force order
structureConfig();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public void onEnable() {
unPrefixedLogger = getServer().getLogger();
cachingPermTool = CachingPermTool.enable(this);
metrics = new Metrics(this, 8700);
data = new PersistentData();

// Fancy enable
prefixedLogger.info(" ");
Expand Down Expand Up @@ -93,6 +92,16 @@ public void onEnable() {
prefixedLogger.warn("##########################################################");
}

try {
getDataFolder().mkdirs();
} catch (Exception e) {
AnarchyExploitFixes.getPrefixedLogger().trace("Failed to create plugin folder!", e);
getServer().getPluginManager().disablePlugin(this);
}

prefixedLogger.info("Loading Datastore");
data = new PersistentData();

prefixedLogger.info("Loading Translations");
reloadLang();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ public class Config {
elytra_teleport_back, elytra_calculate_3D;

public Config() throws Exception {
// Create plugin folder first if it does not exist yet
File pluginFolder = AnarchyExploitFixes.getInstance().getDataFolder();
if (!pluginFolder.exists() && !pluginFolder.mkdir())
AnarchyExploitFixes.getPrefixedLogger().error("Failed to create plugin folder.");
// Load config.yml with ConfigMaster
this.config = ConfigFile.loadConfig(new File(pluginFolder, "config.yml"));
this.config = ConfigFile.loadConfig(new File(AnarchyExploitFixes.getInstance().getDataFolder(), "config.yml"));

// Pre-structure to force order
structureConfig();

Expand Down

0 comments on commit 99a5f2e

Please sign in to comment.