mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
51 lines
1.4 KiB
Java
51 lines
1.4 KiB
Java
|
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);
|
||
|
}
|
||
|
}
|