mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-23 03:14:56 +00:00
Finished implementing new config management.
This commit is contained in:
parent
5f6c37cfee
commit
d1ed5b8509
2 changed files with 11 additions and 6 deletions
|
@ -26,7 +26,7 @@ dist.jar=${dist.dir}/TotalFreedomMod.jar
|
|||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
file.reference.bukkit-0.0.1-SNAPSHOT.jar=C:\\github\\bukkit-0.0.1-SNAPSHOT.jar
|
||||
file.reference.bukkit-0.0.1-SNAPSHOT.jar=C:\\github\\Bukkit\\target\\bukkit-0.0.1-SNAPSHOT.jar
|
||||
file.reference.MobDisguise.jar=C:\\github\\MobDisguise\\dist\\MobDisguise.jar
|
||||
includes=**
|
||||
jar.compress=false
|
||||
|
|
|
@ -72,7 +72,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
loadConfig();
|
||||
loadTFMConfig();
|
||||
|
||||
registerEventHandlers();
|
||||
|
||||
|
@ -219,8 +219,10 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
return removed;
|
||||
}
|
||||
|
||||
private void loadConfig()
|
||||
private void loadTFMConfig()
|
||||
{
|
||||
log.info("[Total Freedom Mod] Loading configuration...");
|
||||
|
||||
createDefaultConfiguration("config.yml");
|
||||
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "config.yml"));
|
||||
|
@ -259,13 +261,15 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
File actual = new File(getDataFolder(), name);
|
||||
if (!actual.exists())
|
||||
{
|
||||
log.info("[Total Freedom Mod]: Loading default configuration file: " + name);
|
||||
InputStream input = null;
|
||||
try
|
||||
{
|
||||
JarFile file = new JarFile(getFile());
|
||||
ZipEntry copy = file.getEntry("src/" + name);
|
||||
ZipEntry copy = file.getEntry(name);
|
||||
if (copy == null)
|
||||
{
|
||||
log.severe("[TotalFreedomMod]: Unable to read default configuration: " + name);
|
||||
return;
|
||||
}
|
||||
input = file.getInputStream(copy);
|
||||
|
@ -280,6 +284,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
try
|
||||
{
|
||||
getDataFolder().mkdirs();
|
||||
output = new FileOutputStream(actual);
|
||||
byte[] buf = new byte[8192];
|
||||
int length = 0;
|
||||
|
@ -288,11 +293,11 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
output.write(buf, 0, length);
|
||||
}
|
||||
|
||||
log.info("[TotalFreedomMod]: Default configuration file written: " + name);
|
||||
log.info("[Total Freedom Mod]: Default configuration file written: " + name);
|
||||
}
|
||||
catch (IOException ioex)
|
||||
{
|
||||
log.severe("[TotalFreedomMod]: Unable to write default configuration: " + name);
|
||||
log.log(Level.SEVERE, "[Total Freedom Mod]: Unable to write default configuration: " + name, ioex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue