Advertisement
Guest User

The Whole ZiPECON file

a guest
Jan 19th, 2014
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. /* 1: */ package me.thomasice.ZiPECON;
  2.  
  3. /* 5: */ import java.util.Map.Entry;
  4. /* 9: */ import org.bukkit.configuration.Configuration;
  5. /* 13: */ import org.bukkit.plugin.java.JavaPlugin;
  6. /* 14: */
  7. /* 15: */ public class ZiPECON
  8. /* 16: */ extends JavaPlugin
  9. /* 17: */ {
  10. /* 18: */ public double startamount;
  11. /* 19: */ private Configuration config;
  12. /* 20: */
  13. /* 21: */ public void onEnable()
  14. /* 22: */ {
  15. /* 23:15 */ getLogger().info("ZiPECON 1.0 has been enabled!");
  16. /* 24:16 */ getServer().getPluginManager().registerEvents(new PlayerLogin(), this);
  17. /* 25:17 */ getServer().getPluginCommand("money").setExecutor(new CommandMoney());
  18. /* 26: */
  19. /* 27:19 */ this.config = getConfig();
  20. /* 28:20 */ this.startamount = this.config.getInt("start-amount", 0);
  21. /* 29:21 */ this.config.set("start-amount", Double.valueOf(this.startamount));
  22. /* 30:22 */ saveConfig();
  23. /* 31:23 */ loadAmounts();
  24. /* 38: */ }
  25. /* 39: */
  26. /* 40: */ public void onDisable()
  27. /* 41: */ {
  28. /* 42:34 */ getLogger().info("ZiPECON 1.0 has been disabled.");
  29. /* 43:35 */ saveAmounts();
  30. /* 44:36 */ saveConfig();
  31. /* 45: */ }
  32. /* 46: */
  33. /* 47: */ public void saveAmounts()
  34. /* 48: */ {
  35. /* 49:40 */ this.config = getConfig();
  36. /* 50:41 */ for (Entry<String, Double> entry : Money.money.entrySet()) {
  37. /* 51:42 */ getConfig().set("money." + (String)entry.getKey(), entry.getValue());
  38. /* 52: */ }
  39. /* 53: */ }
  40. /* 54: */
  41. /* 55: */ public void loadAmounts()
  42. /* 56: */ {
  43. /* 57:47 */ for (String key : getConfig().getConfigurationSection("money.").getKeys(false)) {
  44. /* 58:48 */ Money.money.put(key, Double.valueOf(getConfig().getInt("money." + key)));
  45. /* 59: */ }
  46. /* 60: */ }
  47. /* 61: */ }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement