
Untitled
By: a guest on
May 2nd, 2012 | syntax:
Java | size: 1.08 KB | hits: 15 | expires: Never
Properties prop = new Properties();
if (!getDataFolder().exists()) {
getDataFolder().mkdir();
}
File pf = new File(getDataFolder(), "config.properties");
boolean first_run = false;
if (!pf.exists()) {
try {
first_run = true;
pf.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
prop.load(new FileInputStream(pf));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
if (first_run) {
prop.setProperty("bot-name", "Minecraft-Bot");
prop.setProperty("irc-network", "irc.esper.net");
prop.setProperty("irc-port", "6667");
prop.setProperty("irc-channel", "#changethis");
prop.setProperty("use-nickserv", "false");
prop.setProperty("nickserv-password", "none");
try {
prop.store(new FileOutputStream(pf), "");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
String network = prop.getProperty("irc-network", "irc.esper.net");