2020-07-13 00:40:11 +00:00
|
|
|
package me.totalfreedom.tfguilds.config;
|
|
|
|
|
|
|
|
import me.totalfreedom.tfguilds.TFGuilds;
|
|
|
|
|
|
|
|
public enum ConfigEntry
|
|
|
|
{
|
2021-05-22 04:26:48 +00:00
|
|
|
|
|
|
|
GUILD_CHAT_LOGGING("server.guild_chat_logging"),
|
|
|
|
GUILD_TAGS("server.guild_tags"),
|
2021-06-15 13:19:25 +00:00
|
|
|
GUILD_TAG_MAX_LENGTH("server.guild_tag_max_length"),
|
|
|
|
GLOBAL_TAG_MAX_LENGTH("server.global_tag_max_length"),
|
2021-05-22 04:26:48 +00:00
|
|
|
MYSQL_HOST("mysql.host"),
|
|
|
|
MYSQL_PORT("mysql.port"),
|
|
|
|
MYSQL_USERNAME("mysql.username"),
|
|
|
|
MYSQL_PASSWORD("mysql.password"),
|
|
|
|
MYSQL_DATABASE("mysql.database");
|
2020-07-13 00:40:11 +00:00
|
|
|
|
|
|
|
private final String path;
|
2021-02-24 20:31:54 +00:00
|
|
|
private final Config config;
|
2021-05-22 04:26:48 +00:00
|
|
|
|
2020-07-13 00:40:11 +00:00
|
|
|
ConfigEntry(String path)
|
|
|
|
{
|
|
|
|
this.path = path;
|
2021-05-22 04:26:48 +00:00
|
|
|
this.config = TFGuilds.getPlugin().getConfig();
|
2020-07-13 00:40:11 +00:00
|
|
|
}
|
|
|
|
|
2020-08-03 21:01:18 +00:00
|
|
|
public boolean getBoolean()
|
2020-07-13 00:40:11 +00:00
|
|
|
{
|
2020-08-03 21:01:18 +00:00
|
|
|
return config.getBoolean(path);
|
2020-07-13 00:40:11 +00:00
|
|
|
}
|
2020-07-29 21:49:19 +00:00
|
|
|
|
2020-08-13 02:41:38 +00:00
|
|
|
public void setBoolean(boolean value)
|
|
|
|
{
|
|
|
|
config.set(path, value);
|
|
|
|
config.save();
|
|
|
|
}
|
|
|
|
|
2021-05-22 04:26:48 +00:00
|
|
|
public int getInteger()
|
|
|
|
{
|
|
|
|
return config.getInt(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getString()
|
2020-07-29 21:49:19 +00:00
|
|
|
{
|
2021-05-22 04:26:48 +00:00
|
|
|
return config.getString(path);
|
2020-07-29 21:49:19 +00:00
|
|
|
}
|
2021-05-22 04:26:48 +00:00
|
|
|
}
|