move chat config options from config.yml -> chat.yml

This commit is contained in:
nossr50
2020-10-29 13:06:22 -07:00
parent 4bac586253
commit 8856d2b071
11 changed files with 148 additions and 75 deletions

View File

@ -0,0 +1,51 @@
package com.gmail.nossr50.config;
import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.util.StringUtils;
import org.jetbrains.annotations.NotNull;
public class ChatConfig extends AutoUpdateConfigLoader {
private static ChatConfig instance;
private ChatConfig() {
super("chat.yml");
validate();
}
public static ChatConfig getInstance() {
if (instance == null) {
instance = new ChatConfig();
}
return instance;
}
@Override
protected void loadKeys() {
//Sigh this old config system...
}
@Override
protected boolean validateKeys() {
return true;
}
public boolean isChatEnabled() {
return config.getBoolean("Chat.Enable", true);
}
public boolean isChatChannelEnabled(@NotNull ChatChannel chatChannel) {
String key = "Chat.Channels." + StringUtils.getCapitalized(chatChannel.toString()) + ".Enabled";
return config.getBoolean(key, true);
}
/**
* Whether or not to use display names for players in target {@link ChatChannel}
* @param chatChannel target chat channel
* @return true if display names should be used
*/
public boolean useDisplayNames(@NotNull ChatChannel chatChannel) {
String key = "Chat.Channels." + StringUtils.getCapitalized(chatChannel.toString()) + ".Use_Display_Names";
return config.getBoolean(key, true);
}
}

View File

@ -259,13 +259,6 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); }
public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
public String getPartyChatPrefix() { return config.getString("Commands.partychat.Chat_Prefix_Format", "[[GREEN]]([[WHITE]]{0}[[GREEN]])"); }
public boolean getPartyChatColorLeaderName() { return config.getBoolean("Commands.partychat.Gold_Leader_Name", true); }
public boolean getPartyDisplayNames() { return config.getBoolean("Commands.partychat.Use_Display_Names", true); }
public String getPartyChatPrefixAlly() { return config.getString("Commands.partychat.Chat_Prefix_Format_Ally", "[[GREEN]](A)[[RESET]]"); }
public String getAdminChatPrefix() { return config.getString("Commands.adminchat.Chat_Prefix_Format", "[[AQUA]][[[WHITE]]{0}[[AQUA]]]"); }
public boolean getAdminDisplayNames() { return config.getBoolean("Commands.adminchat.Use_Display_Names", true); }
public boolean getMatchOfflinePlayers() { return config.getBoolean("Commands.Generic.Match_OfflinePlayers", false); }
public long getDatabasePlayerCooldown() { return config.getLong("Commands.Database.Player_Cooldown", 1750); }