settings.java 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import java.util.logging.Level;
  2. import java.util.logging.Logger;
  3. import java.io.File;
  4. import java.io.FileWriter;
  5. public class settings {
  6. private final static Object syncLock = new Object();
  7. protected static final Logger log = Logger.getLogger("Minecraft");
  8. private static volatile settings instance;
  9. static boolean toggle = true;
  10. private boolean adminChat = false;
  11. private boolean greentext = false;
  12. private boolean FFF = false;
  13. private boolean quakeColors = false;
  14. private boolean cmdFabulous = false;
  15. private boolean cmdPromote = false;
  16. private boolean cmdDemote = false;
  17. private boolean cmdWhoIs = false;
  18. private boolean cmdRules = false;
  19. private boolean cmdTp = false;
  20. private boolean cmdTphere = false;
  21. private boolean globalmessages = false;
  22. private boolean cmdSay = false;
  23. private PropertiesFile properties;
  24. String file = "vminecraft.properties";
  25. public String rules[] = null;
  26. public void loadSettings()
  27. {
  28. if(properties == null)
  29. {
  30. properties = new PropertiesFile("vminecraft.properties");
  31. } else {
  32. properties.load();
  33. }
  34. try {
  35. adminChat = properties.getBoolean("adminchat",true);
  36. greentext = properties.getBoolean("greentext",true);
  37. FFF = properties.getBoolean("FFF",true);
  38. quakeColors = properties.getBoolean("quakeColors",true);
  39. cmdFabulous = properties.getBoolean("cmdFabulous",true);
  40. cmdPromote = properties.getBoolean("cmdPromote",true);
  41. cmdDemote = properties.getBoolean("cmdDemote",true);
  42. cmdWhoIs = properties.getBoolean("cmdWhoIs",true);
  43. cmdRules = properties.getBoolean("cmdRules",true);
  44. cmdTp = properties.getBoolean("cmdTp",true);
  45. cmdTphere = properties.getBoolean("cmdTphere",true);
  46. globalmessages = properties.getBoolean("globalmessages",true);
  47. cmdSay = properties.getBoolean("cmdSay",true);
  48. rules = properties.getString("rules", "").split("@");
  49. id.a.log(Level.INFO, "vminecraft plugin successfully loaded");
  50. }
  51. catch (Exception e)
  52. {
  53. log.log(Level.SEVERE, "vminecraft Error: ERROR LOADING PROPERTIES FILE");
  54. }
  55. }
  56. public boolean adminchat() {return adminChat;}
  57. public boolean greentext() {return greentext;}
  58. public boolean FFF() {return FFF;}
  59. public boolean quakeColors() {return quakeColors;}
  60. public boolean cmdFabulous() {return cmdFabulous;}
  61. public boolean cmdPromote() {return cmdPromote;}
  62. public boolean cmdDemote() {return cmdDemote;}
  63. public boolean cmdWhoIs() {return cmdWhoIs;}
  64. public boolean cmdTp() {return cmdTp;}
  65. public boolean cmdTphere() {return cmdTphere;}
  66. public boolean cmdSay() {return cmdSay;}
  67. public boolean cmdRules() {return cmdRules;}
  68. public boolean globalmessages() {return globalmessages;}
  69. public static settings getInstance() {
  70. if (instance == null) {
  71. instance = new settings();
  72. }
  73. return instance;
  74. }
  75. //Will return the rules
  76. public String[] getRules() {
  77. return rules;
  78. }
  79. }