Remove settings saving on addon disabling.

Settings are saved on each Settings GUI building.
This commit is contained in:
BONNe 2020-05-08 10:20:44 +03:00 committed by BONNe1704
parent ffac90f84c
commit da5fab8558
2 changed files with 11 additions and 0 deletions

View File

@ -286,7 +286,14 @@ public class ChallengesAddon extends Addon {
if (this.hooked) { if (this.hooked) {
this.challengesManager.save(); this.challengesManager.save();
} }
}
/**
* This method saves addon settings into file.
*/
public void saveSettings()
{
if (this.settings != null) if (this.settings != null)
{ {
new Config<>(this, Settings.class).saveConfigObject(this.settings); new Config<>(this, Settings.class).saveConfigObject(this.settings);

View File

@ -124,6 +124,10 @@ public class EditSettingsGUI extends CommonGUI
// Return Button // Return Button
panelBuilder.item(44, this.returnButton); 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(); panelBuilder.build();
} }