mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-09-30 00:27:26 +02:00
Add default toggle for confirm commands in config.yml.
This commit is contained in:
parent
752565b8f1
commit
1ef1cd98db
@ -302,4 +302,8 @@ public interface ISettings extends IConf {
|
|||||||
int getMotdDelay();
|
int getMotdDelay();
|
||||||
|
|
||||||
boolean isDirectHatAllowed();
|
boolean isDirectHatAllowed();
|
||||||
|
|
||||||
|
List<String> getDefaultDisabledConfirmCommands();
|
||||||
|
|
||||||
|
boolean isConfirmCommandEnabledByDefault(String commandName);
|
||||||
}
|
}
|
@ -532,6 +532,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||||||
npcsInBalanceRanking = _isNpcsInBalanceRanking();
|
npcsInBalanceRanking = _isNpcsInBalanceRanking();
|
||||||
currencyFormat = _getCurrencyFormat();
|
currencyFormat = _getCurrencyFormat();
|
||||||
unprotectedSigns = _getUnprotectedSign();
|
unprotectedSigns = _getUnprotectedSign();
|
||||||
|
defaultDisabledConfirmCommands = _getDefaultDisabledConfirmCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
||||||
@ -1418,4 +1419,24 @@ public class Settings implements net.ess3.api.ISettings {
|
|||||||
public boolean isDirectHatAllowed() {
|
public boolean isDirectHatAllowed() {
|
||||||
return config.getBoolean("allow-direct-hat", true);
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
@ -898,14 +898,14 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
|||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean confirmPay = false; // players deny pay confirmation by default
|
private Boolean confirmPay;
|
||||||
|
|
||||||
public boolean _getConfirmPay() {
|
private Boolean _getConfirmPay() {
|
||||||
return config.getBoolean("confirm-pay", false);
|
return (Boolean) config.get("confirm-pay");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPromptingPayConfirm() {
|
public boolean isPromptingPayConfirm() {
|
||||||
return confirmPay;
|
return confirmPay != null ? confirmPay : ess.getSettings().isConfirmCommandEnabledByDefault("pay");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPromptingPayConfirm(boolean prompt) {
|
public void setPromptingPayConfirm(boolean prompt) {
|
||||||
@ -914,14 +914,14 @@ public abstract class UserData extends PlayerExtension implements IConf {
|
|||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean confirmClear = false; // players deny clear confirmation by default
|
private Boolean confirmClear;
|
||||||
|
|
||||||
public boolean _getConfirmClear() {
|
private Boolean _getConfirmClear() {
|
||||||
return config.getBoolean("confirm-clear", false);
|
return (Boolean) config.get("confirm-clear");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPromptingClearConfirm() {
|
public boolean isPromptingClearConfirm() {
|
||||||
return confirmClear;
|
return confirmClear != null ? confirmClear : ess.getSettings().isConfirmCommandEnabledByDefault("clearinventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPromptingClearConfirm(boolean prompt) {
|
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.
|
# This has no effect if the MOTD command or permission are disabled.
|
||||||
delay-motd: 0
|
delay-motd: 0
|
||||||
|
|
||||||
|
# A list of commands that should have their complementary confirm commands disabled by default.
|
||||||
|
# This is empty by default, for the latest list of valid commands see the latest source config.yml.
|
||||||
|
default-disabled-confirm-commands:
|
||||||
|
#- pay
|
||||||
|
#- clearinventory
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# +------------------------------------------------------+ #
|
# +------------------------------------------------------+ #
|
||||||
# | EssentialsHome | #
|
# | EssentialsHome | #
|
||||||
|
Loading…
Reference in New Issue
Block a user