mirror of
https://github.com/darksaid98/Builders-Utilities.git
synced 2026-12-01 22:14:56 +00:00
Setup slf4j and shade bstats (#5)
This commit is contained in:
1 parent
9806a083bc
commit
5b07416c08
4 files changed
+30
-752
No files matched your search
@@ -28,6 +28,8 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.io.File;
|
||||
@@ -37,6 +39,8 @@ import java.util.Set;
|
||||
|
||||
public class CustomConfig {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger("BU/" + CustomConfig.class.getSimpleName());
|
||||
|
||||
private final JavaPlugin plugin;
|
||||
private final String fileName;
|
||||
private final File configFile;
|
||||
@@ -58,7 +62,7 @@ public class CustomConfig {
|
||||
|
||||
public void reloadConfig() {
|
||||
if (!configFile.exists()) {
|
||||
plugin.getLogger().info("Attempting to save resource: " + configFile.getName());
|
||||
logger.info("Attempting to save resource: {}", configFile.getName());
|
||||
plugin.saveResource(fileName, true);
|
||||
}
|
||||
config = YamlConfiguration.loadConfiguration(configFile);
|
||||
@@ -68,8 +72,7 @@ public class CustomConfig {
|
||||
try {
|
||||
config.save(configFile);
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().severe(String.format("Couldn't save '%s', because: '%s'", fileName,
|
||||
e.getMessage()));
|
||||
logger.error("Couldn't save {}, because {}", fileName, e.getMessage());
|
||||
}
|
||||
reloadConfig();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user