Saves command rank settings to bentobox config.yml

https://github.com/BentoBoxWorld/BentoBox/issues/657
This commit is contained in:
tastybento 2019-05-03 22:29:03 -07:00
parent 4e0e283ace
commit 2b2ee7e42c
4 changed files with 16 additions and 8 deletions

View File

@ -110,7 +110,7 @@ public class BentoBox extends JavaPlugin {
return; return;
} }
// Saving the config now. // Saving the config now.
new Config<>(this, Settings.class).saveConfigObject(settings); saveConfig();
// Start Database managers // Start Database managers
playersManager = new PlayersManager(this); playersManager = new PlayersManager(this);
@ -333,6 +333,11 @@ public class BentoBox extends JavaPlugin {
return true; return true;
} }
@Override
public void saveConfig() {
if (settings != null) new Config<>(this, Settings.class).saveConfigObject(settings);
}
/** /**
* @return the notifier * @return the notifier
*/ */

View File

@ -74,7 +74,7 @@ public class Settings implements DataObject {
private Set<String> fakePlayers = new HashSet<>(); private Set<String> fakePlayers = new HashSet<>();
@ConfigComment("Rank required to use a command. e.g., use the invite command. Default is owner rank is required.") @ConfigComment("Rank required to use a command. e.g., use the invite command. Default is owner rank is required.")
@ConfigEntry(path = "general.rank-command", experimental = true) @ConfigEntry(path = "general.rank-command")
private Map<String, Integer> rankCommand = new HashMap<>(); private Map<String, Integer> rankCommand = new HashMap<>();
@ConfigEntry(path = "panel.close-on-click-outside") @ConfigEntry(path = "panel.close-on-click-outside")

View File

@ -57,6 +57,9 @@ public class CommandCycleClick implements ClickHandler {
} }
// Apply change to panel // Apply change to panel
panel.getInventory().setItem(slot, commandRankClickListener.getPanelItem(command, user).getItem()); panel.getInventory().setItem(slot, commandRankClickListener.getPanelItem(command, user).getItem());
// Save config
plugin.saveConfig();
} else { } else {
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F); user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F);
} }