mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-05-01 02:38:25 +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}:\
|
${javac.test.classpath}:\
|
||||||
${build.test.classes.dir}
|
${build.test.classes.dir}
|
||||||
source.encoding=UTF-8
|
source.encoding=UTF-8
|
||||||
|
source.reference.craftbukkit.jar=U:\\Users\\KHobbits\\GIT\\CraftBukkit\\src\\main\\java\\
|
||||||
src.dir=src
|
src.dir=src
|
||||||
test.src.dir=test
|
test.src.dir=test
|
||||||
|
|
|
@ -91,18 +91,7 @@ public class EssentialsConf extends YamlConfiguration
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
return;
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,6 +356,28 @@ public class EssentialsConf extends YamlConfiguration
|
||||||
|
|
||||||
final String data = saveToString();
|
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);
|
final OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), UTF8);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in a new issue