Add default toggle for confirm commands in config.yml.

This commit is contained in:
Ali Moghnieh 2018-01-28 16:47:17 +00:00
parent 752565b8f1
commit 1ef1cd98db
No known key found for this signature in database
GPG key ID: F09D3A1BAF2E6D70
4 changed files with 41 additions and 10 deletions

View file

@ -532,6 +532,7 @@ public class Settings implements net.ess3.api.ISettings {
npcsInBalanceRanking = _isNpcsInBalanceRanking();
currencyFormat = _getCurrencyFormat();
unprotectedSigns = _getUnprotectedSign();
defaultDisabledConfirmCommands = _getDefaultDisabledConfirmCommands();
}
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
@ -1418,4 +1419,24 @@ public class Settings implements net.ess3.api.ISettings {
public boolean isDirectHatAllowed() {
return config.getBoolean("allow-direct-hat", true);
}
}
private List<String> defaultDisabledConfirmCommands;
private List<String> _getDefaultDisabledConfirmCommands() {
List<String> commands = config.getStringList("default-disabled-confirm-commands");
for (int i = 0; i < commands.size(); i++) {
commands.set(i, commands.get(i).toLowerCase());
}
return commands;
}
@Override
public List<String> getDefaultDisabledConfirmCommands() {
return defaultDisabledConfirmCommands;
}
@Override
public boolean isConfirmCommandEnabledByDefault(String commandName) {
return !getDefaultDisabledConfirmCommands().contains(commandName.toLowerCase());
}
}