1
0

re-add clicking message to message someone

This commit is contained in:
Lee
2024-03-28 19:36:04 +00:00
parent 74deffbf82
commit 6d166befa2
3 changed files with 75 additions and 6 deletions

View File

@ -0,0 +1,69 @@
package cc.fascinated.config;
import cc.fascinated.Aetheria;
import lombok.Getter;
import org.bukkit.configuration.file.FileConfiguration;
import java.util.HashMap;
import java.util.List;
@Getter
public enum Config {
INFLUXDB_URL("influxdb.url"),
INFLUXDB_TOKEN("influxdb.token"),
INFLUXDB_ORG("influxdb.org"),
INFLUXDB_BUCKET("influxdb.bucket");
/**
* The path of the lang in the lang.yml file.
*/
private final String path;
Config(String path) {
this.path = path;
}
/**
* Cache of the config values.
*/
private final HashMap<String, Object> cache = new HashMap<>();
/**
* The configuration.
*/
private final cc.fascinated.utils.io.Config config = new cc.fascinated.utils.io.Config(Aetheria.INSTANCE, "config.yml", null);
/**
* Gets as an object.
*
* @return the string
*/
public Object get() {
return cache.computeIfAbsent(path, key -> {
FileConfiguration configuration = config.getFileConfiguration();
if (configuration.get(path) == null) {
throw new IllegalArgumentException("Path " + path + " does not exist in the config.yml file.");
}
return configuration.get(path);
});
}
/**
* Gets as a string.
*
* @return the string
*/
public String getAsString() {
return (String) get();
}
/**
* Gets as a string list.
*
* @return the string list
*/
public List<String> getAsStringList() {
return (List<String>) get();
}
}