Skip to content

Commit

Permalink
Remove settings saving on addon disabling.
Browse files Browse the repository at this point in the history
Settings are saved on each Settings GUI building.
  • Loading branch information
BONNe committed May 8, 2020
1 parent ffac90f commit da5fab8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/world/bentobox/challenges/ChallengesAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,14 @@ public void onDisable() {
if (this.hooked) {
this.challengesManager.save();
}
}


/**
* This method saves addon settings into file.
*/
public void saveSettings()
{
if (this.settings != null)
{
new Config<>(this, Settings.class).saveConfigObject(this.settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ public void build()
// Return Button
panelBuilder.item(44, this.returnButton);

// Save Settings every time this GUI is created. It will avoid issues with
// Overwritten setting after server stop.
this.addon.saveSettings();

panelBuilder.build();
}

Expand Down

0 comments on commit da5fab8

Please sign in to comment.