Advertisement
Lisenochek

Untitled

Aug 14th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.realistic.api;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.event.Listener;
  5. import org.bukkit.plugin.java.JavaPlugin;
  6.  
  7. import com.realistic.config.configMessage;
  8. import com.realistic.events.Events;
  9. import com.realistic.timers.Blood_Effect;
  10. import com.realistic.timers.Blooding;
  11. import com.realistic.timers.Broken_Bones_Messages;
  12. import com.realistic.timers.Cold;
  13. import com.realistic.timers.Disease_Cold;
  14. import com.realistic.timers.Disease_Pneumonia;
  15. import com.realistic.timers.Spawn_Crate;
  16. import com.realistic.timers.Spawn_Crate_Particles;
  17.  
  18. public class API extends JavaPlugin implements Listener {
  19.  
  20.     // Инстансы классов
  21.  
  22.     private API plugin;
  23.     @SuppressWarnings("unused")
  24.     private ItemList il;
  25.     @SuppressWarnings("unused")
  26.     private BlockList bl;
  27.     private configMessage cm;
  28.     @SuppressWarnings("unused")
  29.     private Items_Recipes ir;
  30.  
  31.     public API(API instance) {
  32.         plugin = instance;
  33.     }
  34.  
  35.     public void onEnable() {
  36.  
  37.         this.bl = new BlockList();
  38.         this.il = new ItemList();
  39.         cm.creatingFile();
  40.         this.ir = new Items_Recipes(this);
  41.  
  42.         Bukkit.getPluginManager().registerEvents(new Events(this), this);
  43.  
  44.         Bukkit.getScheduler().runTaskTimer(this, new Blood_Effect(this), 1, 1);
  45.         Bukkit.getScheduler().runTaskTimer(this, new Spawn_Crate_Particles(this), 1, 1);
  46.         Bukkit.getScheduler().runTaskTimer(this, new Spawn_Crate(this), 500, 500);
  47.         Bukkit.getScheduler().runTaskTimer(this, new Blooding(this), 200, 200);
  48.         Bukkit.getScheduler().runTaskTimer(this, new Broken_Bones_Messages(this), 200, 200);
  49.         Bukkit.getScheduler().runTaskTimer(this, new Disease_Cold(this), 200, 200);
  50.         Bukkit.getScheduler().runTaskTimer(this, new Disease_Pneumonia(this), 200, 200);
  51.         Bukkit.getScheduler().runTaskTimer(this, new Cold(this), 200, 200);
  52.  
  53.         // Регистрация команд
  54.  
  55.         getCommand("realistic").setExecutor(new CommandAPI());
  56.         getCommand("realistic-guide").setExecutor(new CommandAPI());
  57.         getCommand("realistic-help").setExecutor(new CommandAPI());
  58.         getCommand("realistic-items").setExecutor(new CommandAPI());
  59.         getCommand("realistic-spawncrate").setExecutor(new CommandAPI());
  60.  
  61.         if (this.getConfig().isConfigurationSection("Disease_Cold")) {
  62.             for (String a : this.getConfig().getConfigurationSection("Disease_Cold").getKeys(false)) {
  63.                 com.realistic.list.MinecraftList.Disease_Cold.put(a,
  64.                         plugin.getConfig().getBoolean("Disease_Cold." + a));
  65.                 this.getConfig().set("Disease_Cold." + a, null);
  66.             }
  67.             this.saveConfig();
  68.         }
  69.  
  70.         if (this.getConfig().isConfigurationSection("Disease_Pneumonia")) {
  71.             for (String a : this.getConfig().getConfigurationSection("Disease_Pneumonia").getKeys(false)) {
  72.                 com.realistic.list.MinecraftList.Disease_Pneumonia.put(a,
  73.                         this.getConfig().getBoolean("Disease_Pneumonia." + a));
  74.                 this.getConfig().set("Disease_Pneumonia." + a, null);
  75.             }
  76.             this.saveConfig();
  77.         }
  78.  
  79.         if (this.getConfig().isConfigurationSection("bloodingPlayers")) {
  80.             for (String a : this.getConfig().getConfigurationSection("bloodingPlayers").getKeys(false)) {
  81.                 com.realistic.list.MinecraftList.bloodingPlayers.put(a,
  82.                         this.getConfig().getBoolean("bloodingPlayers." + a));
  83.                 this.getConfig().set("bloodingPlayers." + a, null);
  84.             }
  85.             this.saveConfig();
  86.         }
  87.  
  88.         if (this.getConfig().isConfigurationSection("Broken_Bones")) {
  89.             for (String a : this.getConfig().getConfigurationSection("Broken_Bones").getKeys(false)) {
  90.                 com.realistic.list.MinecraftList.Broken_Bones.put(a, this.getConfig().getBoolean("Broken_Bones." + a));
  91.                 this.getConfig().set("Broken_Bones." + a, null);
  92.             }
  93.             this.saveConfig();
  94.         }
  95.     }
  96.  
  97.     public void onDisable() {
  98.  
  99.         for (String pn : com.realistic.list.MinecraftList.Disease_Cold.keySet()) {
  100.             this.getConfig().set("Disease_Cold." + pn, com.realistic.list.MinecraftList.Disease_Cold.get(pn));
  101.         }
  102.  
  103.         for (String pn : com.realistic.list.MinecraftList.bloodingPlayers.keySet()) {
  104.             this.getConfig().set("bloodingPlayers." + pn, com.realistic.list.MinecraftList.bloodingPlayers.get(pn));
  105.         }
  106.  
  107.         for (String pn : com.realistic.list.MinecraftList.Broken_Bones.keySet()) {
  108.             this.getConfig().set("Broken_Bones." + pn, com.realistic.list.MinecraftList.Broken_Bones.get(pn));
  109.         }
  110.  
  111.         for (String pn : com.realistic.list.MinecraftList.Disease_Pneumonia.keySet()) {
  112.             this.getConfig().set("Disease_Pneumonia." + pn, com.realistic.list.MinecraftList.Disease_Pneumonia.get(pn));
  113.         }
  114.  
  115.         this.saveConfig();
  116.     }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement