Add chat question config option

This commit is contained in:
Josh Roy 2021-09-16 22:55:16 -04:00
parent d5822e9a41
commit 94edbcfeb1
4 changed files with 11 additions and 1 deletions

View File

@ -46,6 +46,8 @@ public interface ISettings extends IConf {
char getChatQuestion(); char getChatQuestion();
boolean isChatQuestionEnabled();
BigDecimal getCommandCost(IEssentialsCommand cmd); BigDecimal getCommandCost(IEssentialsCommand cmd);
BigDecimal getCommandCost(String label); BigDecimal getCommandCost(String label);

View File

@ -226,6 +226,11 @@ public class Settings implements net.ess3.api.ISettings {
return chatQuestion; return chatQuestion;
} }
@Override
public boolean isChatQuestionEnabled() {
return config.getBoolean("chat.question-enabled", true);
}
public boolean _isTeleportSafetyEnabled() { public boolean _isTeleportSafetyEnabled() {
return config.getBoolean("teleport-safety", true); return config.getBoolean("teleport-safety", true);
} }

View File

@ -921,6 +921,9 @@ chat:
# plots: "&dP&r" # plots: "&dP&r"
# creative: "&eC&r" # creative: "&eC&r"
# Whether chat questions should be enabled or not.
question-enabled: true
############################################################ ############################################################
# +------------------------------------------------------+ # # +------------------------------------------------------+ #
# | EssentialsX Protect | # # | EssentialsX Protect | #

View File

@ -38,7 +38,7 @@ public abstract class EssentialsChatPlayer implements Listener {
final char prefix = message.charAt(0); final char prefix = message.charAt(0);
if (prefix == ess.getSettings().getChatShout() || user.isToggleShout()) { if (prefix == ess.getSettings().getChatShout() || user.isToggleShout()) {
return message.length() > 1 ? "shout" : ""; return message.length() > 1 ? "shout" : "";
} else if (prefix == ess.getSettings().getChatQuestion()) { } else if (ess.getSettings().isChatQuestionEnabled() && prefix == ess.getSettings().getChatQuestion()) {
return message.length() > 1 ? "question" : ""; return message.length() > 1 ? "question" : "";
} else { } else {
return ""; return "";