mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-27 01:40:48 +08:00
Merge branch 'SupaHam-default-confirm-command-prompt' into 2.x
This commit is contained in:
commit
7d7c58fa7c
@ -302,4 +302,8 @@ public interface ISettings extends IConf {
|
||||
int getMotdDelay();
|
||||
|
||||
boolean isDirectHatAllowed();
|
||||
}
|
||||
|
||||
List<String> getDefaultEnabledConfirmCommands();
|
||||
|
||||
boolean isConfirmCommandEnabledByDefault(String commandName);
|
||||
}
|
||||
|
@ -532,6 +532,7 @@ public class Settings implements net.ess3.api.ISettings {
|
||||
npcsInBalanceRanking = _isNpcsInBalanceRanking();
|
||||
currencyFormat = _getCurrencyFormat();
|
||||
unprotectedSigns = _getUnprotectedSign();
|
||||
defaultEnabledConfirmCommands = _getDefaultEnabledConfirmCommands();
|
||||
}
|
||||
|
||||
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> defaultEnabledConfirmCommands;
|
||||
|
||||
private List<String> _getDefaultEnabledConfirmCommands() {
|
||||
List<String> commands = config.getStringList("default-enabled-confirm-commands");
|
||||
for (int i = 0; i < commands.size(); i++) {
|
||||
commands.set(i, commands.get(i).toLowerCase());
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDefaultEnabledConfirmCommands() {
|
||||
return defaultEnabledConfirmCommands;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConfirmCommandEnabledByDefault(String commandName) {
|
||||
return getDefaultEnabledConfirmCommands().contains(commandName.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
@ -898,14 +898,14 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
save();
|
||||
}
|
||||
|
||||
private boolean confirmPay = false; // players deny pay confirmation by default
|
||||
private Boolean confirmPay;
|
||||
|
||||
public boolean _getConfirmPay() {
|
||||
return config.getBoolean("confirm-pay", false);
|
||||
private Boolean _getConfirmPay() {
|
||||
return (Boolean) config.get("confirm-pay");
|
||||
}
|
||||
|
||||
public boolean isPromptingPayConfirm() {
|
||||
return confirmPay;
|
||||
return confirmPay != null ? confirmPay : ess.getSettings().isConfirmCommandEnabledByDefault("pay");
|
||||
}
|
||||
|
||||
public void setPromptingPayConfirm(boolean prompt) {
|
||||
@ -914,14 +914,14 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
||||
save();
|
||||
}
|
||||
|
||||
private boolean confirmClear = false; // players deny clear confirmation by default
|
||||
private Boolean confirmClear;
|
||||
|
||||
public boolean _getConfirmClear() {
|
||||
return config.getBoolean("confirm-clear", false);
|
||||
private Boolean _getConfirmClear() {
|
||||
return (Boolean) config.get("confirm-clear");
|
||||
}
|
||||
|
||||
public boolean isPromptingClearConfirm() {
|
||||
return confirmClear;
|
||||
return confirmClear != null ? confirmClear : ess.getSettings().isConfirmCommandEnabledByDefault("clearinventory");
|
||||
}
|
||||
|
||||
public void setPromptingClearConfirm(boolean prompt) {
|
||||
|
@ -516,6 +516,12 @@ allow-bulk-buy-sell: true
|
||||
# This has no effect if the MOTD command or permission are disabled.
|
||||
delay-motd: 0
|
||||
|
||||
# A list of commands that should have their complementary confirm commands enabled by default.
|
||||
# This is empty by default, for the latest list of valid commands see the latest source config.yml.
|
||||
default-enabled-confirm-commands:
|
||||
#- pay
|
||||
#- clearinventory
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | EssentialsHome | #
|
||||
|
Loading…
Reference in New Issue
Block a user