Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.bricedev.wrcp;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.Map;
- import org.bukkit.Bukkit;
- import org.bukkit.Effect;
- import org.bukkit.Location;
- import org.bukkit.entity.Player;
- import org.bukkit.event.Listener;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.scheduler.BukkitRunnable;
- public class Main
- extends JavaPlugin implements Listener {
- static Main pl;
- static GenerateChest gc = new GenerateChest();
- Database data = Database.instance;
- LoadChances lc = LoadChances.instance;
- Timer timer = Timer.instance;
- FindAvaliableLocation fal = new FindAvaliableLocation();
- ArrayList<String> commands = new ArrayList();
- public void onEnable() {
- saveDefaultConfig();
- if (!getConfig().isInt("LargestDinctance_Y")) {
- getConfig().set("LargestDinctance_Y", Integer.valueOf(300));
- getConfig().set("SmallestDinctance_Y", Integer.valueOf(60));
- saveConfig();
- saveDefaultConfig();
- }
- if (!getConfig().isList("CommandsToExecuteOnLoot")) {
- ArrayList<String> commands = new ArrayList<String>();
- commands.add("eco give {player} 100");
- getConfig().set("CommandsToExecuteOnLoot", commands);
- saveConfig();
- saveDefaultConfig();
- }
- this.data.setup(this);
- this.data.data.options().copyDefaults(true);
- pl = this;
- gc.GenerateChest(getConfig().getInt("SpawnChestPerTime"));
- if (!this.data.data.isConfigurationSection("Chests")) {
- this.data.data.createSection("Chests");
- this.data.saveData();
- }
- if (!this.data.data.isConfigurationSection("ItemDatabase")) {
- this.data.data.createSection("ItemDatabase");
- this.data.saveData();
- }
- if (!this.data.data.isConfigurationSection("LocationDatabase")) {
- this.data.data.createSection("LocationDatabase");
- this.data.saveData();
- }
- getCommand("wcp").setExecutor(new CommandManager());
- getServer().getPluginManager().registerEvents(new LootEvent(), this);
- getServer().getPluginManager().registerEvents(new ItemAdderGui(), this);
- if (getConfig().getBoolean("Particles")) {
- Particles();
- }
- this.lc.loaditems();
- if (getConfig().getBoolean("KillChest")) {
- this.timer.decrease();
- }
- this.timer.loadchests();
- this.fal.init();
- if (getConfig().getList("CommandsToExecuteOnLoot") != null) {
- this.commands = (ArrayList)getConfig().getList("CommandsToExecuteOnLoot");
- }
- }
- public void onDisable() { this.timer.saveChests(); }
- HashMap<Location, Integer> chests = new HashMap();
- ArrayList<Player> abletobreak = new ArrayList();
- ArrayList<Player> additem = new ArrayList();
- static HashMap<Integer, ItemStack> items = new HashMap();
- HashMap<Integer, ItemStack> itemstoadd = new HashMap();
- HashMap<Integer, Integer> chances = new HashMap();
- HashMap<Player, Integer> currentpage = new HashMap();
- HashMap<Player, Integer> idediting = new HashMap();
- HashMap<Player, Integer> lastpageno = new HashMap();
- public void Particles() {
- new BukkitRunnable() {
- public void run() {
- try {
- for (Map.Entry<Location, Integer> e : Main.this.chests.entrySet()) {
- Location loc = (Location) e.getKey();
- loc.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 1);
- }
- } catch (Exception exception) {
- }
- }
- }.runTaskTimer(Main.pl, 20, 20L);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement