Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: Java  |  size: 1.08 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.                 Properties prop = new Properties();
  2.  
  3.                 if (!getDataFolder().exists()) {
  4.                         getDataFolder().mkdir();
  5.                 }
  6.  
  7.                 File pf = new File(getDataFolder(), "config.properties");
  8.                 boolean first_run = false;
  9.                 if (!pf.exists()) {
  10.                         try {
  11.                                 first_run = true;
  12.                                 pf.createNewFile();
  13.                         } catch (IOException e) {
  14.                                 e.printStackTrace();
  15.                         }
  16.                 }
  17.                 try {
  18.                         prop.load(new FileInputStream(pf));
  19.                 } catch (FileNotFoundException e) {
  20.                         e.printStackTrace();
  21.                 } catch (IOException e) {
  22.                         e.printStackTrace();
  23.                 }
  24.  
  25.                 if (first_run) {
  26.                         prop.setProperty("bot-name", "Minecraft-Bot");
  27.                         prop.setProperty("irc-network", "irc.esper.net");
  28.                         prop.setProperty("irc-port", "6667");
  29.                         prop.setProperty("irc-channel", "#changethis");
  30.                         prop.setProperty("use-nickserv", "false");
  31.                         prop.setProperty("nickserv-password", "none");
  32.                         try {
  33.                                 prop.store(new FileOutputStream(pf), "");
  34.                         } catch (FileNotFoundException e) {
  35.                                 e.printStackTrace();
  36.                         } catch (IOException e) {
  37.                                 e.printStackTrace();
  38.                         }
  39.                 }
  40.  
  41.                 String network = prop.getProperty("irc-network", "irc.esper.net");