mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-26 20:55:41 +01:00
Saves command rank settings to bentobox config.yml
https://github.com/BentoBoxWorld/BentoBox/issues/657
This commit is contained in:
parent
4e0e283ace
commit
2b2ee7e42c
@ -110,7 +110,7 @@ public class BentoBox extends JavaPlugin {
|
||||
return;
|
||||
}
|
||||
// Saving the config now.
|
||||
new Config<>(this, Settings.class).saveConfigObject(settings);
|
||||
saveConfig();
|
||||
|
||||
// Start Database managers
|
||||
playersManager = new PlayersManager(this);
|
||||
@ -154,7 +154,7 @@ public class BentoBox extends JavaPlugin {
|
||||
addonsManager.loadAddons();
|
||||
// Enable addons
|
||||
addonsManager.enableAddons();
|
||||
|
||||
|
||||
// Register default gamemode placeholders
|
||||
addonsManager.getGameModeAddons().forEach(placeholdersManager::registerDefaultPlaceholders);
|
||||
|
||||
@ -333,6 +333,11 @@ public class BentoBox extends JavaPlugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveConfig() {
|
||||
if (settings != null) new Config<>(this, Settings.class).saveConfigObject(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the notifier
|
||||
*/
|
||||
|
@ -74,7 +74,7 @@ public class Settings implements DataObject {
|
||||
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.")
|
||||
@ConfigEntry(path = "general.rank-command", experimental = true)
|
||||
@ConfigEntry(path = "general.rank-command")
|
||||
private Map<String, Integer> rankCommand = new HashMap<>();
|
||||
|
||||
@ConfigEntry(path = "panel.close-on-click-outside")
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
package world.bentobox.bentobox.listeners.flags.clicklisteners;
|
||||
|
||||
@ -57,6 +57,9 @@ public class CommandCycleClick implements ClickHandler {
|
||||
}
|
||||
// Apply change to panel
|
||||
panel.getInventory().setItem(slot, commandRankClickListener.getPanelItem(command, user).getItem());
|
||||
// Save config
|
||||
plugin.saveConfig();
|
||||
|
||||
} else {
|
||||
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
package world.bentobox.bentobox.listeners.flags.clicklisteners;
|
||||
|
||||
@ -30,7 +30,7 @@ import world.bentobox.bentobox.util.Util;
|
||||
*
|
||||
*/
|
||||
public class CommandRankClickListener implements ClickHandler {
|
||||
|
||||
|
||||
private BentoBox plugin = BentoBox.getInstance();
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -107,7 +107,7 @@ public class CommandRankClickListener implements ClickHandler {
|
||||
List<String> result = new ArrayList<>();
|
||||
plugin.getCommandsManager().getCommands().values().stream()
|
||||
.filter(c -> c.getWorld() != null && c.getWorld().equals(world))
|
||||
.forEach(c -> result.addAll(getCmdRecursively("/", c)));
|
||||
.forEach(c -> result.addAll(getCmdRecursively("/", c)));
|
||||
if (result.size() > 49) {
|
||||
Bukkit.getLogger().severe("Number of rank setting commands is too big for GUI");
|
||||
result.subList(49, result.size()).clear();
|
||||
@ -127,7 +127,7 @@ public class CommandRankClickListener implements ClickHandler {
|
||||
if (cc.isConfigurableRankCommand()) {
|
||||
result.add(newLabel);
|
||||
}
|
||||
cc.getSubCommands().values().forEach(s -> result.addAll(getCmdRecursively(newLabel + " ", s)));
|
||||
cc.getSubCommands().values().forEach(s -> result.addAll(getCmdRecursively(newLabel + " ", s)));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user