vUpdatr.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //Thanks to Yogoda for the code!
  2. import java.io.*;
  3. import java.util.logging.*;
  4. public class vUpdatr {
  5. static final String pluginName = "vMinecraft";
  6. static final String version = "0.1";
  7. static final String updatrUrl = "http://dl.dropbox.com/u/18212134/vMinecraft.updatr";
  8. static final String updatrFileUrl = "http://dl.dropbox.com/u/18212134/vMinecraft.jar";
  9. static final String updatrNotes = "Added Updatr support!";
  10. private static volatile vUpdatr instance;
  11. public static Logger logger = Logger.getLogger("Minecraft");
  12. public void createUpdatrFile(){
  13. try {
  14. File updatrDir = new File("Updatr");
  15. //create Updatr directory if it does not exsits already
  16. if(updatrDir.exists()){
  17. File updatrFile = new File("Updatr" + File.separator + pluginName + ".updatr");
  18. //Updatr file does not exist, create it
  19. if(!updatrFile.exists()){
  20. updatrFile.createNewFile();
  21. BufferedWriter writer = new BufferedWriter(new FileWriter(updatrFile));
  22. writer.write("name = " + pluginName); writer.newLine();
  23. writer.write("version = " + version); writer.newLine();
  24. writer.write("url = " + updatrUrl); writer.newLine();
  25. writer.write("file = " + updatrFileUrl); writer.newLine();
  26. writer.write("notes = " + updatrNotes); writer.newLine();
  27. writer.close();
  28. }
  29. }
  30. } catch (IOException e) {
  31. vUpdatr.logger.log(Level.SEVERE, null, e);
  32. }
  33. }
  34. public static vUpdatr getInstance(){
  35. if (instance == null){
  36. instance = new vUpdatr();
  37. }
  38. return instance;
  39. }
  40. }