diff options
Diffstat (limited to 'src/main/java')
| -rw-r--r-- | src/main/java/world/anhgelus/molehunt/config/SimpleConfig.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/world/anhgelus/molehunt/config/SimpleConfig.java b/src/main/java/world/anhgelus/molehunt/config/SimpleConfig.java index ef8bef3..2b65829 100644 --- a/src/main/java/world/anhgelus/molehunt/config/SimpleConfig.java +++ b/src/main/java/world/anhgelus/molehunt/config/SimpleConfig.java @@ -2,7 +2,7 @@ package world.anhgelus.molehunt.config; /* * Copyright (c) 2021 magistermaks - * Slightly modified by Léo-21 + * Slightly modified by Léo-21 and Anhgelus Morhtuuzh * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -30,6 +30,7 @@ import org.apache.logging.log4j.Logger; import java.io.File; import java.io.IOException; import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.HashMap; @@ -110,7 +111,7 @@ public class SimpleConfig { Files.createFile( request.file.toPath() ); // write default config data - PrintWriter writer = new PrintWriter(request.file, "UTF-8"); + PrintWriter writer = new PrintWriter(request.file, StandardCharsets.UTF_8); writer.write( request.getConfig() ); writer.close(); @@ -139,12 +140,12 @@ public class SimpleConfig { String identifier = "Config '" + request.filename + "'"; if( !request.file.exists() ) { - LOGGER.info( identifier + " is missing, generating default one..." ); + LOGGER.info("{} is missing, generating default one...", identifier); try { createConfig(); } catch (IOException e) { - LOGGER.error( identifier + " failed to generate!" ); + LOGGER.error("{} failed to generate!", identifier); LOGGER.trace( e ); broken = true; } @@ -154,7 +155,7 @@ public class SimpleConfig { try { loadConfig(); } catch (Exception e) { - LOGGER.error( identifier + " failed to load!" ); + LOGGER.error("{} failed to load!", identifier); LOGGER.trace( e ); broken = true; } @@ -245,7 +246,7 @@ public class SimpleConfig { * @return true if the operation was successful */ public boolean delete() { - LOGGER.warn( "Config '" + request.filename + "' was removed from existence! Restart the game to regenerate it." ); + LOGGER.warn("Config '{}' was removed from existence! Restart the game to regenerate it.", request.filename); return request.file.delete(); } |
