Skip to content

Commit

Permalink
Close FastCraft+ interfaces on "/fca reload"
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWoodworth committed Apr 23, 2016
1 parent 03a0662 commit 4760572
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
25 changes: 20 additions & 5 deletions src/main/java/co/kepler/fastcraftplus/FastCraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void onEnable() {
externalConfigs.add(lang = new LanguageConfig());
externalConfigs.add(recipes = new RecipesConfig());
externalConfigs.add(blacklist = new BlacklistConfig());
loadConfigs();
load();

// Load managers
recipeCompatManager = new RecipeCompatManager();
Expand All @@ -58,19 +58,34 @@ public void onEnable() {

@Override
public void onDisable() {
GUI.disposeAll();
PlayerManager.Prefs.saveAllPrefs();
unload();
}

/**
* Load all FastCraft+ configs.
* Load FastCraft+.
*/
public static void loadConfigs() {
public static void load() {
for (ConfigExternal conf : getInstance().externalConfigs) {
conf.load();
}
}

/**
* Unload FastCraft+.
*/
public static void unload() {
GUI.disposeAll();
PlayerManager.Prefs.saveAllPrefs();
}

/**
* Reload FastCraft+.
*/
public void reload() {
unload();
load();
}

/**
* Get an instance of FastCraft.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public boolean onCommand(CommandSender sender, String[] args) {
} else if (!sender.hasPermission(Permission.ADMIN_RELOAD)) {
sender.sendMessage(FastCraft.lang().commands_noPerm(Permission.ADMIN_RELOAD));
} else {
FastCraft.loadConfigs();
FastCraft.getInstance().reload();
sender.sendMessage(FastCraft.lang().commands_fastcraftadmin_reload_output());
}
return true;
Expand Down

0 comments on commit 4760572

Please sign in to comment.