Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.realistic.api;
- import org.bukkit.Bukkit;
- import org.bukkit.event.Listener;
- import org.bukkit.plugin.java.JavaPlugin;
- import com.realistic.config.configMessage;
- import com.realistic.events.Events;
- import com.realistic.timers.Blood_Effect;
- import com.realistic.timers.Blooding;
- import com.realistic.timers.Broken_Bones_Messages;
- import com.realistic.timers.Cold;
- import com.realistic.timers.Disease_Cold;
- import com.realistic.timers.Disease_Pneumonia;
- import com.realistic.timers.Spawn_Crate;
- import com.realistic.timers.Spawn_Crate_Particles;
- public class API extends JavaPlugin implements Listener {
- // Инстансы классов
- private API plugin;
- @SuppressWarnings("unused")
- private ItemList il;
- @SuppressWarnings("unused")
- private BlockList bl;
- private configMessage cm;
- @SuppressWarnings("unused")
- private Items_Recipes ir;
- public API(API instance) {
- plugin = instance;
- }
- public void onEnable() {
- this.bl = new BlockList();
- this.il = new ItemList();
- cm.creatingFile();
- this.ir = new Items_Recipes(this);
- Bukkit.getPluginManager().registerEvents(new Events(this), this);
- Bukkit.getScheduler().runTaskTimer(this, new Blood_Effect(this), 1, 1);
- Bukkit.getScheduler().runTaskTimer(this, new Spawn_Crate_Particles(this), 1, 1);
- Bukkit.getScheduler().runTaskTimer(this, new Spawn_Crate(this), 500, 500);
- Bukkit.getScheduler().runTaskTimer(this, new Blooding(this), 200, 200);
- Bukkit.getScheduler().runTaskTimer(this, new Broken_Bones_Messages(this), 200, 200);
- Bukkit.getScheduler().runTaskTimer(this, new Disease_Cold(this), 200, 200);
- Bukkit.getScheduler().runTaskTimer(this, new Disease_Pneumonia(this), 200, 200);
- Bukkit.getScheduler().runTaskTimer(this, new Cold(this), 200, 200);
- // Регистрация команд
- getCommand("realistic").setExecutor(new CommandAPI());
- getCommand("realistic-guide").setExecutor(new CommandAPI());
- getCommand("realistic-help").setExecutor(new CommandAPI());
- getCommand("realistic-items").setExecutor(new CommandAPI());
- getCommand("realistic-spawncrate").setExecutor(new CommandAPI());
- if (this.getConfig().isConfigurationSection("Disease_Cold")) {
- for (String a : this.getConfig().getConfigurationSection("Disease_Cold").getKeys(false)) {
- com.realistic.list.MinecraftList.Disease_Cold.put(a,
- plugin.getConfig().getBoolean("Disease_Cold." + a));
- this.getConfig().set("Disease_Cold." + a, null);
- }
- this.saveConfig();
- }
- if (this.getConfig().isConfigurationSection("Disease_Pneumonia")) {
- for (String a : this.getConfig().getConfigurationSection("Disease_Pneumonia").getKeys(false)) {
- com.realistic.list.MinecraftList.Disease_Pneumonia.put(a,
- this.getConfig().getBoolean("Disease_Pneumonia." + a));
- this.getConfig().set("Disease_Pneumonia." + a, null);
- }
- this.saveConfig();
- }
- if (this.getConfig().isConfigurationSection("bloodingPlayers")) {
- for (String a : this.getConfig().getConfigurationSection("bloodingPlayers").getKeys(false)) {
- com.realistic.list.MinecraftList.bloodingPlayers.put(a,
- this.getConfig().getBoolean("bloodingPlayers." + a));
- this.getConfig().set("bloodingPlayers." + a, null);
- }
- this.saveConfig();
- }
- if (this.getConfig().isConfigurationSection("Broken_Bones")) {
- for (String a : this.getConfig().getConfigurationSection("Broken_Bones").getKeys(false)) {
- com.realistic.list.MinecraftList.Broken_Bones.put(a, this.getConfig().getBoolean("Broken_Bones." + a));
- this.getConfig().set("Broken_Bones." + a, null);
- }
- this.saveConfig();
- }
- }
- public void onDisable() {
- for (String pn : com.realistic.list.MinecraftList.Disease_Cold.keySet()) {
- this.getConfig().set("Disease_Cold." + pn, com.realistic.list.MinecraftList.Disease_Cold.get(pn));
- }
- for (String pn : com.realistic.list.MinecraftList.bloodingPlayers.keySet()) {
- this.getConfig().set("bloodingPlayers." + pn, com.realistic.list.MinecraftList.bloodingPlayers.get(pn));
- }
- for (String pn : com.realistic.list.MinecraftList.Broken_Bones.keySet()) {
- this.getConfig().set("Broken_Bones." + pn, com.realistic.list.MinecraftList.Broken_Bones.get(pn));
- }
- for (String pn : com.realistic.list.MinecraftList.Disease_Pneumonia.keySet()) {
- this.getConfig().set("Disease_Pneumonia." + pn, com.realistic.list.MinecraftList.Disease_Pneumonia.get(pn));
- }
- this.saveConfig();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement