mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-26 08:29:44 +00:00
Don't create empty user files
This commit is contained in:
parent
0296f4fcf1
commit
d3967297bb
2 changed files with 24 additions and 12 deletions
|
@ -150,5 +150,6 @@ run.test.classpath=\
|
|||
${javac.test.classpath}:\
|
||||
${build.test.classes.dir}
|
||||
source.encoding=UTF-8
|
||||
source.reference.craftbukkit.jar=U:\\Users\\KHobbits\\GIT\\CraftBukkit\\src\\main\\java\\
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
|
|
|
@ -91,18 +91,7 @@ public class EssentialsConf extends YamlConfiguration
|
|||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("creatingEmptyConfig", configFile.toString()));
|
||||
if (!configFile.createNewFile())
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()), ex);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -367,6 +356,28 @@ public class EssentialsConf extends YamlConfiguration
|
|||
|
||||
final String data = saveToString();
|
||||
|
||||
if (data.length() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!configFile.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("creatingEmptyConfig", configFile.toString()));
|
||||
if (!configFile.createNewFile())
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), UTF8);
|
||||
|
||||
try
|
||||
|
|
Loading…
Reference in a new issue