Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 203.66 KB | None | 0 0
  1. // Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov  Date: 2014/4/25 上午 12:23:49
  2. // Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!
  3. // Decompiler options: packimports(3)
  4. // Source File Name:   uSkyBlock.java
  5.  
  6. package us.talabrek.ultimateskyblock;
  7.  
  8. import com.sk89q.worldedit.MaxChangedBlocksException;
  9. import com.sk89q.worldedit.data.DataException;
  10. import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
  11. import com.sk89q.worldguard.protection.managers.RegionManager;
  12. import java.io.*;
  13. import java.text.DateFormat;
  14. import java.text.DecimalFormat;
  15. import java.util.*;
  16. import java.util.logging.Level;
  17. import java.util.logging.Logger;
  18. import net.milkbowl.vault.economy.Economy;
  19. import org.bukkit.*;
  20. import org.bukkit.block.*;
  21. import org.bukkit.command.CommandSender;
  22. import org.bukkit.command.PluginCommand;
  23. import org.bukkit.configuration.ConfigurationSection;
  24. import org.bukkit.configuration.file.FileConfiguration;
  25. import org.bukkit.configuration.file.YamlConfiguration;
  26. import org.bukkit.entity.*;
  27. import org.bukkit.generator.ChunkGenerator;
  28. import org.bukkit.inventory.*;
  29. import org.bukkit.inventory.meta.ItemMeta;
  30. import org.bukkit.inventory.meta.SkullMeta;
  31. import org.bukkit.plugin.PluginDescriptionFile;
  32. import org.bukkit.plugin.PluginManager;
  33. import org.bukkit.plugin.java.JavaPlugin;
  34. import org.bukkit.scheduler.BukkitScheduler;
  35.  
  36. // Referenced classes of package us.talabrek.ultimateskyblock:
  37. //            VaultHandler, IslandCommand, ChallengesCommand, DevCommand,
  38. //            Settings, PlayerInfo, WorldGuardHandler, PlayerJoin,
  39. //            ProtectionEvents, SkyBlockChunkGenerator, WorldEditHandler, SerializableLocation,
  40. //            Challenge
  41.  
  42. public class uSkyBlock extends JavaPlugin
  43. {
  44.  
  45.     public uSkyBlock()
  46.     {
  47.         df = new DecimalFormat(".#");
  48.         levelConfig = null;
  49.         lastIslandConfig = null;
  50.         orphans = null;
  51.         tempIsland = null;
  52.         tempPlayer = null;
  53.         islands = new HashMap();
  54.         levelConfigFile = null;
  55.         orphanFile = null;
  56.         lastIslandConfigFile = null;
  57.         islandConfigFile = null;
  58.         tempIslandFile = null;
  59.         tempPlayerFile = null;
  60.         removeList = new ArrayList();
  61.         orphaned = new Stack();
  62.         tempOrphaned = new Stack();
  63.         reverseOrphaned = new Stack();
  64.         islandTestLocation = null;
  65.         infoCooldown = new HashMap();
  66.         restartCooldown = new HashMap();
  67.         biomeCooldown = new HashMap();
  68.         activePlayers = new HashMap();
  69.         challenges = new LinkedHashMap();
  70.         requiredList = new HashMap();
  71.         purgeActive = false;
  72.         skyblockData = null;
  73.         skyblockDataFile = null;
  74.         GUIparty = null;
  75.         GUIpartyPlayer = null;
  76.         GUIisland = null;
  77.         GUIchallenge = null;
  78.         GUIbiome = null;
  79.         GUIlog = null;
  80.         pHead = new ItemStack(397, 1, (short)3);
  81.         sign = new ItemStack(323, 1);
  82.         biome = new ItemStack(6, 1, (short)3);
  83.         lock = new ItemStack(101, 1);
  84.         warpset = new ItemStack(90, 1);
  85.         warptoggle = new ItemStack(69, 1);
  86.         invite = new ItemStack(398, 1);
  87.         kick = new ItemStack(301, 1);
  88.         currentBiomeItem = null;
  89.         currentIslandItem = null;
  90.         currentChallengeItem = null;
  91.         currentLogItem = null;
  92.         lores = new ArrayList();
  93.     }
  94.  
  95.     public void onDisable()
  96.     {
  97.         try
  98.         {
  99.             unloadPlayerFiles();
  100.             if(lastIsland != null)
  101.                 setLastIsland(lastIsland);
  102.         }
  103.         catch(Exception e)
  104.         {
  105.             System.out.println("Something went wrong saving the island and/or party data!");
  106.             e.printStackTrace();
  107.         }
  108.         log.info((new StringBuilder(String.valueOf(pluginFile.getName()))).append(" v").append(pluginFile.getVersion()).append(" disabled.").toString());
  109.     }
  110.  
  111.     public void onEnable()
  112.     {
  113.         instance = this;
  114.         saveDefaultConfig();
  115.         saveDefaultLevelConfig();
  116.         saveDefaultOrphans();
  117.         pluginFile = getDescription();
  118.         log = getLogger();
  119.         pName = (new StringBuilder()).append(ChatColor.WHITE).append("[").append(ChatColor.GREEN).append(pluginFile.getName()).append(ChatColor.WHITE).append("] ").toString();
  120.         VaultHandler.setupEconomy();
  121.         if(!getDataFolder().exists())
  122.             getDataFolder().mkdir();
  123.         configPlugin = getConfig();
  124.         filePlugin = new File(getDataFolder(), "config.yml");
  125.         loadPluginConfig();
  126.         loadLevelConfig();
  127.         registerEvents();
  128.         directoryPlayers = new File((new StringBuilder()).append(getDataFolder()).append(File.separator).append("players").toString());
  129.         directoryIslands = new File((new StringBuilder()).append(getDataFolder()).append(File.separator).append("islands").toString());
  130.         if(!directoryPlayers.exists())
  131.         {
  132.             directoryPlayers.mkdir();
  133.             loadPlayerFiles();
  134.         } else
  135.         {
  136.             loadPlayerFiles();
  137.         }
  138.         if(!directoryIslands.exists())
  139.             directoryIslands.mkdir();
  140.         directorySchematics = new File((new StringBuilder()).append(getDataFolder()).append(File.separator).append("schematics").toString());
  141.         if(!directorySchematics.exists())
  142.             directorySchematics.mkdir();
  143.         schemFile = directorySchematics.listFiles();
  144.         if(schemFile == null)
  145.             System.out.print("[uSkyBlock] No schematic file loaded.");
  146.         else
  147.             System.out.print((new StringBuilder("[uSkyBlock] ")).append(schemFile.length).append(" schematics loaded.").toString());
  148.         getCommand("island").setExecutor(new IslandCommand());
  149.         getCommand("challenges").setExecutor(new ChallengesCommand());
  150.         getCommand("dev").setExecutor(new DevCommand());
  151.         if(Settings.island_useTopTen)
  152.             getInstance().updateTopTen(getInstance().generateTopTen());
  153.         populateChallengeList();
  154.         log.info((new StringBuilder(String.valueOf(pluginFile.getName()))).append(" v.").append(pluginFile.getVersion()).append(" enabled.").toString());
  155.         getInstance().getServer().getScheduler().runTaskLater(getInstance(), new Runnable() {
  156.  
  157.             public void run()
  158.             {
  159.                 if(Bukkit.getServer().getPluginManager().isPluginEnabled("Vault"))
  160.                 {
  161.                     System.out.print("[uSkyBlock] Using vault for permissions");
  162.                     VaultHandler.setupPermissions();
  163.                     try
  164.                     {
  165.                         if(!getLastIslandConfig().contains("options.general.lastIslandX") && getConfig().contains("options.general.lastIslandX"))
  166.                         {
  167.                             getLastIslandConfig();
  168.                             FileConfiguration.createPath(getLastIslandConfig().getConfigurationSection("options.general"), "lastIslandX");
  169.                             getLastIslandConfig();
  170.                             FileConfiguration.createPath(getLastIslandConfig().getConfigurationSection("options.general"), "lastIslandZ");
  171.                             getLastIslandConfig().set("options.general.lastIslandX", Integer.valueOf(getConfig().getInt("options.general.lastIslandX")));
  172.                             getLastIslandConfig().set("options.general.lastIslandZ", Integer.valueOf(getConfig().getInt("options.general.lastIslandZ")));
  173.                             saveLastIslandConfig();
  174.                         }
  175.                         lastIsland = new Location(uSkyBlock.getSkyBlockWorld(), getLastIslandConfig().getInt("options.general.lastIslandX"), Settings.island_height, getLastIslandConfig().getInt("options.general.lastIslandZ"));
  176.                     }
  177.                     catch(Exception e)
  178.                     {
  179.                         lastIsland = new Location(uSkyBlock.getSkyBlockWorld(), getConfig().getInt("options.general.lastIslandX"), Settings.island_height, getConfig().getInt("options.general.lastIslandZ"));
  180.                     }
  181.                     if(lastIsland == null)
  182.                         lastIsland = new Location(uSkyBlock.getSkyBlockWorld(), 0.0D, Settings.island_height, 0.0D);
  183.                     if(Settings.island_protectWithWorldGuard && !Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))
  184.                     {
  185.                         PluginManager manager = uSkyBlock.getInstance().getServer().getPluginManager();
  186.                         System.out.print("[uSkyBlock] WorldGuard not loaded! Using built in protection.");
  187.                         manager.registerEvents(new ProtectionEvents(), uSkyBlock.getInstance());
  188.                     }
  189.                     uSkyBlock.getInstance().setupOrphans();
  190.                 }
  191.             }
  192.  
  193.             final uSkyBlock this$0;
  194.  
  195.            
  196.             {
  197.                 this$0 = uSkyBlock.this;
  198.                 super();
  199.             }
  200.         }
  201. , 0L);
  202.     }
  203.  
  204.     public static uSkyBlock getInstance()
  205.     {
  206.         return instance;
  207.     }
  208.  
  209.     public void loadPlayerFiles()
  210.     {
  211.         int onlinePlayerCount = 0;
  212.         onlinePlayerCount = Bukkit.getServer().getOnlinePlayers().length;
  213.         Player onlinePlayers[] = Bukkit.getServer().getOnlinePlayers();
  214.         for(int i = 0; i < onlinePlayerCount; i++)
  215.             if(onlinePlayers[i].isOnline())
  216.             {
  217.                 File f = new File(getInstance().directoryPlayers, onlinePlayers[i].getName());
  218.                 PlayerInfo pi = new PlayerInfo(onlinePlayers[i].getName());
  219.                 if(f.exists())
  220.                 {
  221.                     PlayerInfo pi2 = getInstance().readPlayerFile(onlinePlayers[i].getName());
  222.                     if(pi2 != null)
  223.                     {
  224.                         pi.setIslandLocation(pi2.getIslandLocation());
  225.                         pi.setHomeLocation(pi2.getHomeLocation());
  226.                         pi.setHasIsland(pi2.getHasIsland());
  227.                         if(getInstance().getIslandConfig(pi.locationForParty()) == null)
  228.                             getInstance().createIslandConfig(pi.locationForParty(), onlinePlayers[i].getName());
  229.                         getInstance().clearIslandConfig(pi.locationForParty(), onlinePlayers[i].getName());
  230.                         if(Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))
  231.                             WorldGuardHandler.protectIsland(onlinePlayers[i], onlinePlayers[i].getName(), pi);
  232.                     }
  233.                     f.delete();
  234.                 }
  235.                 getInstance().addActivePlayer(onlinePlayers[i].getName(), pi);
  236.                 if(pi.getHasIsland() && getInstance().getTempIslandConfig(pi.locationForParty()) == null)
  237.                 {
  238.                     getInstance().createIslandConfig(pi.locationForParty(), onlinePlayers[i].getName());
  239.                     System.out.println("Creating new Config File");
  240.                 }
  241.                 getInstance().getIslandConfig(pi.locationForParty());
  242.             }
  243.  
  244.         System.out.print("Island Configs Loaded:");
  245.         getInstance().displayIslandConfigs();
  246.     }
  247.  
  248.     public void unloadPlayerFiles()
  249.     {
  250.         for(int i = 0; i < Bukkit.getServer().getOnlinePlayers().length; i++)
  251.         {
  252.             Player removedPlayers[] = Bukkit.getServer().getOnlinePlayers();
  253.             if(getActivePlayers().containsKey(removedPlayers[i].getName()))
  254.                 removeActivePlayer(removedPlayers[i].getName());
  255.         }
  256.  
  257.     }
  258.  
  259.     public void registerEvents()
  260.     {
  261.         PluginManager manager = getServer().getPluginManager();
  262.         manager.registerEvents(new PlayerJoin(), this);
  263.         if(!Settings.island_protectWithWorldGuard)
  264.         {
  265.             System.out.print("[uSkyBlock] Using built in protection.");
  266.             manager.registerEvents(new ProtectionEvents(), getInstance());
  267.         } else
  268.         {
  269.             System.out.print("[uSkyBlock] Using WorldGuard protection.");
  270.         }
  271.     }
  272.  
  273.     public void loadPluginConfig()
  274.     {
  275.         try
  276.         {
  277.             getConfig();
  278.         }
  279.         catch(Exception e)
  280.         {
  281.             e.printStackTrace();
  282.         }
  283.         try
  284.         {
  285.             Settings.general_maxPartySize = getConfig().getInt("options.general.maxPartySize");
  286.             if(Settings.general_maxPartySize < 0)
  287.                 Settings.general_maxPartySize = 0;
  288.         }
  289.         catch(Exception e)
  290.         {
  291.             Settings.general_maxPartySize = 4;
  292.         }
  293.         try
  294.         {
  295.             Settings.island_distance = getConfig().getInt("options.island.distance");
  296.             if(Settings.island_distance < 50)
  297.                 Settings.island_distance = 50;
  298.         }
  299.         catch(Exception e)
  300.         {
  301.             Settings.island_distance = 110;
  302.         }
  303.         try
  304.         {
  305.             Settings.island_protectionRange = getConfig().getInt("options.island.protectionRange");
  306.             if(Settings.island_protectionRange > Settings.island_distance)
  307.                 Settings.island_protectionRange = Settings.island_distance;
  308.         }
  309.         catch(Exception e)
  310.         {
  311.             Settings.island_protectionRange = 100;
  312.         }
  313.         try
  314.         {
  315.             Settings.general_cooldownInfo = getConfig().getInt("options.general.cooldownInfo");
  316.             if(Settings.general_cooldownInfo < 0)
  317.                 Settings.general_cooldownInfo = 0;
  318.         }
  319.         catch(Exception e)
  320.         {
  321.             Settings.general_cooldownInfo = 60;
  322.         }
  323.         try
  324.         {
  325.             Settings.general_biomeChange = getConfig().getInt("options.general.biomeChange");
  326.             if(Settings.general_biomeChange < 0)
  327.                 Settings.general_biomeChange = 0;
  328.         }
  329.         catch(Exception e)
  330.         {
  331.             Settings.general_biomeChange = 3600;
  332.         }
  333.         try
  334.         {
  335.             Settings.general_cooldownRestart = getConfig().getInt("options.general.cooldownRestart");
  336.             if(Settings.general_cooldownRestart < 0)
  337.                 Settings.general_cooldownRestart = 0;
  338.         }
  339.         catch(Exception e)
  340.         {
  341.             Settings.general_cooldownRestart = 60;
  342.         }
  343.         try
  344.         {
  345.             Settings.island_height = getConfig().getInt("options.island.height");
  346.             if(Settings.island_height < 20)
  347.                 Settings.island_height = 20;
  348.         }
  349.         catch(Exception e)
  350.         {
  351.             Settings.island_height = 120;
  352.         }
  353.         try
  354.         {
  355.             Settings.challenges_rankLeeway = getConfig().getInt("options.challenges.rankLeeway");
  356.             if(Settings.challenges_rankLeeway < 0)
  357.                 Settings.challenges_rankLeeway = 0;
  358.         }
  359.         catch(Exception e)
  360.         {
  361.             Settings.challenges_rankLeeway = 0;
  362.         }
  363.         if(!getConfig().contains("options.extras.obsidianToLava"))
  364.         {
  365.             getConfig().set("options.extras.obsidianToLava", Boolean.valueOf(true));
  366.             saveConfig();
  367.         }
  368.         if(!getConfig().contains("options.general.spawnSize"))
  369.         {
  370.             getConfig().set("options.general.spawnSize", Integer.valueOf(50));
  371.             saveConfig();
  372.         }
  373.         try
  374.         {
  375.             Settings.general_spawnSize = getConfig().getInt("options.general.spawnSize");
  376.             if(Settings.general_spawnSize < 50)
  377.                 Settings.general_spawnSize = 50;
  378.         }
  379.         catch(Exception e)
  380.         {
  381.             Settings.general_spawnSize = 50;
  382.         }
  383.         String chestItemString[] = getConfig().getString("options.island.chestItems").split(" ");
  384.         ItemStack tempChest[] = new ItemStack[chestItemString.length];
  385.         String amountdata[] = new String[2];
  386.         for(int i = 0; i < tempChest.length; i++)
  387.         {
  388.             amountdata = chestItemString[i].split(":");
  389.             tempChest[i] = new ItemStack(Integer.parseInt(amountdata[0]), Integer.parseInt(amountdata[1]));
  390.         }
  391.  
  392.         Settings.island_chestItems = tempChest;
  393.         Settings.island_allowPvP = getConfig().getString("options.island.allowPvP");
  394.         Settings.island_schematicName = getConfig().getString("options.island.schematicName");
  395.         if(!Settings.island_allowPvP.equalsIgnoreCase("allow"))
  396.             Settings.island_allowPvP = "deny";
  397.         Set permissionList = getConfig().getConfigurationSection("options.island.extraPermissions").getKeys(true);
  398.         Settings.island_addExtraItems = getConfig().getBoolean("options.island.addExtraItems");
  399.         Settings.extras_obsidianToLava = getConfig().getBoolean("options.extras.obsidianToLava");
  400.         Settings.island_useIslandLevel = getConfig().getBoolean("options.island.useIslandLevel");
  401.         Settings.island_extraPermissions = (String[])permissionList.toArray(new String[0]);
  402.         Settings.island_protectWithWorldGuard = getConfig().getBoolean("options.island.protectWithWorldGuard");
  403.         Settings.extras_sendToSpawn = getConfig().getBoolean("options.extras.sendToSpawn");
  404.         Settings.island_useTopTen = getConfig().getBoolean("options.island.useTopTen");
  405.         Settings.general_worldName = getConfig().getString("options.general.worldName");
  406.         Settings.island_removeCreaturesByTeleport = getConfig().getBoolean("options.island.removeCreaturesByTeleport");
  407.         Settings.island_allowIslandLock = getConfig().getBoolean("options.island.allowIslandLock");
  408.         Settings.island_useOldIslands = getConfig().getBoolean("options.island.useOldIslands");
  409.         Set challengeList = getConfig().getConfigurationSection("options.challenges.challengeList").getKeys(false);
  410.         Settings.challenges_challengeList = challengeList;
  411.         Settings.challenges_broadcastCompletion = getConfig().getBoolean("options.challenges.broadcastCompletion");
  412.         Settings.challenges_broadcastText = getConfig().getString("options.challenges.broadcastText");
  413.         Settings.challenges_challengeColor = getConfig().getString("options.challenges.challengeColor");
  414.         Settings.challenges_enableEconomyPlugin = getConfig().getBoolean("options.challenges.enableEconomyPlugin");
  415.         Settings.challenges_finishedColor = getConfig().getString("options.challenges.finishedColor");
  416.         Settings.challenges_repeatableColor = getConfig().getString("options.challenges.repeatableColor");
  417.         Settings.challenges_requirePreviousRank = getConfig().getBoolean("options.challenges.requirePreviousRank");
  418.         Settings.challenges_allowChallenges = getConfig().getBoolean("options.challenges.allowChallenges");
  419.         String rankListString[] = getConfig().getString("options.challenges.ranks").split(" ");
  420.         Settings.challenges_ranks = rankListString;
  421.     }
  422.  
  423.     public List readPartyFile()
  424.     {
  425.         File f = new File(getDataFolder(), "partylist.bin");
  426.         if(!f.exists())
  427.             return null;
  428.         try
  429.         {
  430.             FileInputStream fileIn = new FileInputStream(f);
  431.             ObjectInputStream in = new ObjectInputStream(fileIn);
  432.             List p = (List)in.readObject();
  433.             in.close();
  434.             fileIn.close();
  435.             return p;
  436.         }
  437.         catch(Exception e)
  438.         {
  439.             e.printStackTrace();
  440.         }
  441.         return null;
  442.     }
  443.  
  444.     public void writePartyFile(List pi)
  445.     {
  446.         File f = new File(getDataFolder(), "partylist.bin");
  447.         try
  448.         {
  449.             FileOutputStream fileOut = new FileOutputStream(f);
  450.             ObjectOutputStream out = new ObjectOutputStream(fileOut);
  451.             out.writeObject(pi);
  452.             out.flush();
  453.             out.close();
  454.             fileOut.close();
  455.         }
  456.         catch(Exception e)
  457.         {
  458.             e.printStackTrace();
  459.         }
  460.     }
  461.  
  462.     public PlayerInfo readPlayerFile(String playerName)
  463.     {
  464.         File f = new File(directoryPlayers, playerName);
  465.         if(!f.exists())
  466.             return null;
  467.         try
  468.         {
  469.             FileInputStream fileIn = new FileInputStream(f);
  470.             ObjectInputStream in = new ObjectInputStream(fileIn);
  471.             PlayerInfo p = (PlayerInfo)in.readObject();
  472.             in.close();
  473.             fileIn.close();
  474.             return p;
  475.         }
  476.         catch(Exception e)
  477.         {
  478.             e.printStackTrace();
  479.         }
  480.         return null;
  481.     }
  482.  
  483.     public boolean displayTopTen(Player player)
  484.     {
  485.         int i = 1;
  486.         int playerrank = 0;
  487.         player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Displaying the top 10 islands:").toString());
  488.         if(topTen == null)
  489.         {
  490.             player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("Top ten list not generated yet!").toString());
  491.             return false;
  492.         }
  493.         for(Iterator iterator = topTen.keySet().iterator(); iterator.hasNext();)
  494.         {
  495.             String playerName = (String)iterator.next();
  496.             if(i <= 10)
  497.                 player.sendMessage((new StringBuilder()).append(ChatColor.GREEN).append("#").append(i).append(": ").append(playerName).append(" - Island level ").append(((Double)topTen.get(playerName)).intValue()).toString());
  498.             if(playerName.equalsIgnoreCase(player.getName()))
  499.                 playerrank = i;
  500.             i++;
  501.         }
  502.  
  503.         player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Your rank is: ").append(ChatColor.WHITE).append(playerrank).toString());
  504.         return true;
  505.     }
  506.  
  507.     public void updateTopTen(LinkedHashMap map)
  508.     {
  509.         topTen = map;
  510.     }
  511.  
  512.     public Location getLocationString(String s)
  513.     {
  514.         if(s == null || s.trim() == "")
  515.             return null;
  516.         String parts[] = s.split(":");
  517.         if(parts.length == 4)
  518.         {
  519.             World w = getServer().getWorld(parts[0]);
  520.             int x = Integer.parseInt(parts[1]);
  521.             int y = Integer.parseInt(parts[2]);
  522.             int z = Integer.parseInt(parts[3]);
  523.             return new Location(w, x, y, z);
  524.         } else
  525.         {
  526.             return null;
  527.         }
  528.     }
  529.  
  530.     public String getStringLocation(Location l)
  531.     {
  532.         if(l == null)
  533.             return "";
  534.         else
  535.             return (new StringBuilder(String.valueOf(l.getWorld().getName()))).append(":").append(l.getBlockX()).append(":").append(l.getBlockY()).append(":").append(l.getBlockZ()).toString();
  536.     }
  537.  
  538.     public void setStringbyPath(FileConfiguration fc, File f, String path, Object value)
  539.     {
  540.         fc.set(path, value.toString());
  541.         try
  542.         {
  543.             fc.save(f);
  544.         }
  545.         catch(IOException e)
  546.         {
  547.             e.printStackTrace();
  548.         }
  549.     }
  550.  
  551.     public String getStringbyPath(FileConfiguration fc, File file, String path, Object stdValue, boolean addMissing)
  552.     {
  553.         if(!fc.contains(path))
  554.         {
  555.             if(addMissing)
  556.                 setStringbyPath(fc, file, path, stdValue);
  557.             return stdValue.toString();
  558.         } else
  559.         {
  560.             return fc.getString(path);
  561.         }
  562.     }
  563.  
  564.     public static World getSkyBlockWorld()
  565.     {
  566.         if(skyBlockWorld == null)
  567.         {
  568.             skyBlockWorld = WorldCreator.name(Settings.general_worldName).type(WorldType.FLAT).environment(org.bukkit.World.Environment.NORMAL).generator(new SkyBlockChunkGenerator()).createWorld();
  569.             if(Bukkit.getServer().getPluginManager().isPluginEnabled("Multiverse-Core"))
  570.                 Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), (new StringBuilder("mv import ")).append(Settings.general_worldName).append(" normal -g uSkyBlock").toString());
  571.         }
  572.         return skyBlockWorld;
  573.     }
  574.  
  575.     public void clearOrphanedIsland()
  576.     {
  577.         for(; hasOrphanedIsland(); orphaned.pop());
  578.     }
  579.  
  580.     public void clearArmorContents(Player player)
  581.     {
  582.         player.getInventory().setArmorContents(new ItemStack[player.getInventory().getArmorContents().length]);
  583.     }
  584.  
  585.     public void getAllFiles(String path)
  586.     {
  587.         File dirpath = new File(path);
  588.         if(!dirpath.exists())
  589.             return;
  590.         File afile[];
  591.         int j = (afile = dirpath.listFiles()).length;
  592.         for(int i = 0; i < j; i++)
  593.         {
  594.             File f = afile[i];
  595.             try
  596.             {
  597.                 if(!f.isDirectory())
  598.                     sfiles.add(f);
  599.                 else
  600.                     getAllFiles(f.getAbsolutePath());
  601.             }
  602.             catch(Exception ex)
  603.             {
  604.                 log.warning(ex.getMessage());
  605.             }
  606.         }
  607.  
  608.     }
  609.  
  610.     public Location getYLocation(Location l)
  611.     {
  612.         for(int y = 0; y < 254; y++)
  613.         {
  614.             int px = l.getBlockX();
  615.             int py = y;
  616.             int pz = l.getBlockZ();
  617.             Block b1 = (new Location(l.getWorld(), px, py, pz)).getBlock();
  618.             Block b2 = (new Location(l.getWorld(), px, py + 1, pz)).getBlock();
  619.             Block b3 = (new Location(l.getWorld(), px, py + 2, pz)).getBlock();
  620.             if(!b1.getType().equals(Material.AIR) && b2.getType().equals(Material.AIR) && b3.getType().equals(Material.AIR))
  621.                 return b2.getLocation();
  622.         }
  623.  
  624.         return l;
  625.     }
  626.  
  627.     public Location getSafeHomeLocation(PlayerInfo p)
  628.     {
  629.         Location home = null;
  630.         if(p.getHomeLocation() == null)
  631.         {
  632.             if(p.getIslandLocation() != null)
  633.                 home = p.getIslandLocation();
  634.         } else
  635.         {
  636.             home = p.getHomeLocation();
  637.         }
  638.         if(isSafeLocation(home))
  639.             return home;
  640.         for(int y = home.getBlockY() + 25; y > 0; y--)
  641.         {
  642.             Location n = new Location(home.getWorld(), home.getBlockX(), y, home.getBlockZ());
  643.             if(isSafeLocation(n))
  644.                 return n;
  645.         }
  646.  
  647.         for(int y = home.getBlockY(); y < 255; y++)
  648.         {
  649.             Location n = new Location(home.getWorld(), home.getBlockX(), y, home.getBlockZ());
  650.             if(isSafeLocation(n))
  651.                 return n;
  652.         }
  653.  
  654.         Location island = p.getIslandLocation();
  655.         if(isSafeLocation(island))
  656.             return island;
  657.         for(int y = island.getBlockY() + 25; y > 0; y--)
  658.         {
  659.             Location n = new Location(island.getWorld(), island.getBlockX(), y, island.getBlockZ());
  660.             if(isSafeLocation(n))
  661.                 return n;
  662.         }
  663.  
  664.         for(int y = island.getBlockY(); y < 255; y++)
  665.         {
  666.             Location n = new Location(island.getWorld(), island.getBlockX(), y, island.getBlockZ());
  667.             if(isSafeLocation(n))
  668.                 return n;
  669.         }
  670.  
  671.         return p.getHomeLocation();
  672.     }
  673.  
  674.     public Location getSafeWarpLocation(PlayerInfo p)
  675.     {
  676.         Location warp = null;
  677.         getTempIslandConfig(p.locationForParty());
  678.         if(tempIsland.getInt("general.warpLocationX") == 0)
  679.         {
  680.             if(p.getHomeLocation() == null)
  681.             {
  682.                 if(p.getIslandLocation() != null)
  683.                     warp = p.getIslandLocation();
  684.             } else
  685.             {
  686.                 warp = p.getHomeLocation();
  687.             }
  688.         } else
  689.         {
  690.             warp = new Location(skyBlockWorld, tempIsland.getInt("general.warpLocationX"), tempIsland.getInt("general.warpLocationY"), tempIsland.getInt("general.warpLocationZ"));
  691.         }
  692.         if(warp == null)
  693.         {
  694.             System.out.print((new StringBuilder("Error warping player to ")).append(p.getPlayerName()).append("'s island.").toString());
  695.             return null;
  696.         }
  697.         if(isSafeLocation(warp))
  698.             return warp;
  699.         for(int y = warp.getBlockY() + 25; y > 0; y--)
  700.         {
  701.             Location n = new Location(warp.getWorld(), warp.getBlockX(), y, warp.getBlockZ());
  702.             if(isSafeLocation(n))
  703.                 return n;
  704.         }
  705.  
  706.         for(int y = warp.getBlockY(); y < 255; y++)
  707.         {
  708.             Location n = new Location(warp.getWorld(), warp.getBlockX(), y, warp.getBlockZ());
  709.             if(isSafeLocation(n))
  710.                 return n;
  711.         }
  712.  
  713.         return null;
  714.     }
  715.  
  716.     public boolean isSafeLocation(Location l)
  717.     {
  718.         if(l == null)
  719.             return false;
  720.         Block ground = l.getBlock().getRelative(BlockFace.DOWN);
  721.         Block air1 = l.getBlock();
  722.         Block air2 = l.getBlock().getRelative(BlockFace.UP);
  723.         if(ground.getType().equals(Material.AIR))
  724.             return false;
  725.         if(ground.getType().equals(Material.LAVA))
  726.             return false;
  727.         if(ground.getType().equals(Material.STATIONARY_LAVA))
  728.             return false;
  729.         if(ground.getType().equals(Material.CACTUS))
  730.             return false;
  731.         return (air1.getType().equals(Material.AIR) || air1.getType().equals(Material.CROPS) || air1.getType().equals(Material.LONG_GRASS) || air1.getType().equals(Material.RED_ROSE) || air1.getType().equals(Material.YELLOW_FLOWER) || air1.getType().equals(Material.DEAD_BUSH) || air1.getType().equals(Material.SIGN_POST) || air1.getType().equals(Material.SIGN)) && air2.getType().equals(Material.AIR);
  732.     }
  733.  
  734.     public void removeCreatures(Location l)
  735.     {
  736.         if(!Settings.island_removeCreaturesByTeleport || l == null)
  737.             return;
  738.         int px = l.getBlockX();
  739.         int py = l.getBlockY();
  740.         int pz = l.getBlockZ();
  741.         for(int x = -1; x <= 1; x++)
  742.         {
  743.             for(int z = -1; z <= 1; z++)
  744.             {
  745.                 Chunk c = l.getWorld().getChunkAt(new Location(l.getWorld(), px + x * 16, py, pz + z * 16));
  746.                 Entity aentity[];
  747.                 int j = (aentity = c.getEntities()).length;
  748.                 for(int i = 0; i < j; i++)
  749.                 {
  750.                     Entity e = aentity[i];
  751.                     if(e.getType() == EntityType.SPIDER || e.getType() == EntityType.CREEPER || e.getType() == EntityType.ENDERMAN || e.getType() == EntityType.SKELETON || e.getType() == EntityType.ZOMBIE)
  752.                         e.remove();
  753.                 }
  754.  
  755.             }
  756.  
  757.         }
  758.  
  759.     }
  760.  
  761.     public void deletePlayerIsland(String player)
  762.     {
  763.         if(!getActivePlayers().containsKey(player))
  764.         {
  765.             PlayerInfo pi = new PlayerInfo(player);
  766.             if(Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard") && WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).hasRegion((new StringBuilder(String.valueOf(player))).append("Island").toString()))
  767.                 WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion((new StringBuilder(String.valueOf(player))).append("Island").toString());
  768.             orphaned.push(pi.getIslandLocation());
  769.             removeIsland(pi.getIslandLocation());
  770.             deleteIslandConfig(pi.locationForParty());
  771.             pi.removeFromIsland();
  772.             saveOrphans();
  773.             pi.savePlayerConfig(player);
  774.         } else
  775.         {
  776.             if(Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard") && WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).hasRegion((new StringBuilder(String.valueOf(player))).append("Island").toString()))
  777.                 WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion((new StringBuilder(String.valueOf(player))).append("Island").toString());
  778.             orphaned.push(((PlayerInfo)getActivePlayers().get(player)).getIslandLocation());
  779.             removeIsland(((PlayerInfo)getActivePlayers().get(player)).getIslandLocation());
  780.             deleteIslandConfig(((PlayerInfo)getActivePlayers().get(player)).locationForParty());
  781.             PlayerInfo pi = new PlayerInfo(player);
  782.             pi.removeFromIsland();
  783.             addActivePlayer(player, pi);
  784.             saveOrphans();
  785.         }
  786.     }
  787.  
  788.     public void restartPlayerIsland(Player player, Location next)
  789.     {
  790.         boolean hasIslandNow = false;
  791.         if(next.getBlockX() == 0 && next.getBlockZ() == 0)
  792.             return;
  793.         removeIsland(next);
  794.         if(getInstance().getSchemFile().length > 0 && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldEdit"))
  795.         {
  796.             String cSchem = "";
  797.             for(int i = 0; i < getInstance().getSchemFile().length; i++)
  798.                 if(!hasIslandNow)
  799.                 {
  800.                     if(getInstance().getSchemFile()[i].getName().lastIndexOf('.') > 0)
  801.                         cSchem = getInstance().getSchemFile()[i].getName().substring(0, getInstance().getSchemFile()[i].getName().lastIndexOf('.'));
  802.                     else
  803.                         cSchem = getInstance().getSchemFile()[i].getName();
  804.                     if(VaultHandler.checkPerk(player.getName(), (new StringBuilder("usb.schematic.")).append(cSchem).toString(), getSkyBlockWorld()))
  805.                         try
  806.                         {
  807.                             if(WorldEditHandler.loadIslandSchematic(getSkyBlockWorld(), getInstance().getSchemFile()[i], next))
  808.                             {
  809.                                 setChest(next, player);
  810.                                 hasIslandNow = true;
  811.                             }
  812.                         }
  813.                         catch(MaxChangedBlocksException e)
  814.                         {
  815.                             e.printStackTrace();
  816.                         }
  817.                         catch(DataException e)
  818.                         {
  819.                             e.printStackTrace();
  820.                         }
  821.                         catch(IOException e)
  822.                         {
  823.                             e.printStackTrace();
  824.                         }
  825.                 }
  826.  
  827.             if(!hasIslandNow)
  828.             {
  829.                 for(int i = 0; i < getInstance().getSchemFile().length; i++)
  830.                 {
  831.                     if(getInstance().getSchemFile()[i].getName().lastIndexOf('.') > 0)
  832.                         cSchem = getInstance().getSchemFile()[i].getName().substring(0, getInstance().getSchemFile()[i].getName().lastIndexOf('.'));
  833.                     else
  834.                         cSchem = getInstance().getSchemFile()[i].getName();
  835.                     if(cSchem.equalsIgnoreCase(Settings.island_schematicName))
  836.                         try
  837.                         {
  838.                             if(WorldEditHandler.loadIslandSchematic(getSkyBlockWorld(), getInstance().getSchemFile()[i], next))
  839.                             {
  840.                                 setChest(next, player);
  841.                                 hasIslandNow = true;
  842.                             }
  843.                         }
  844.                         catch(MaxChangedBlocksException e)
  845.                         {
  846.                             e.printStackTrace();
  847.                         }
  848.                         catch(DataException e)
  849.                         {
  850.                             e.printStackTrace();
  851.                         }
  852.                         catch(IOException e)
  853.                         {
  854.                             e.printStackTrace();
  855.                         }
  856.                 }
  857.  
  858.             }
  859.         }
  860.         if(!hasIslandNow)
  861.             if(!Settings.island_useOldIslands)
  862.                 generateIslandBlocks(next.getBlockX(), next.getBlockZ(), player, getSkyBlockWorld());
  863.             else
  864.                 oldGenerateIslandBlocks(next.getBlockX(), next.getBlockZ(), player, getSkyBlockWorld());
  865.         next.setY(Settings.island_height);
  866.         System.out.println(next.getBlockY());
  867.         setNewPlayerIsland(player, next);
  868.         player.getInventory().clear();
  869.         player.getEquipment().clear();
  870.         getInstance().changePlayerBiome(player, "OCEAN");
  871.         for(int x = (Settings.island_protectionRange / 2) * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16)
  872.         {
  873.             for(int z = (Settings.island_protectionRange / 2) * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16)
  874.                 getSkyBlockWorld().refreshChunk((next.getBlockX() + x) / 16, (next.getBlockZ() + z) / 16);
  875.  
  876.         }
  877.  
  878.         for(Iterator ents = player.getNearbyEntities(Settings.island_protectionRange / 2, 250D, Settings.island_protectionRange / 2).iterator(); ents.hasNext();)
  879.         {
  880.             Entity tempent = (Entity)ents.next();
  881.             if(!(tempent instanceof Player))
  882.                 tempent.remove();
  883.         }
  884.  
  885.     }
  886.  
  887.     public void devDeletePlayerIsland(String player)
  888.     {
  889.         if(!getActivePlayers().containsKey(player))
  890.         {
  891.             PlayerInfo pi = new PlayerInfo(player);
  892.             if(Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard") && WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).hasRegion((new StringBuilder(String.valueOf(player))).append("Island").toString()))
  893.                 WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion((new StringBuilder(String.valueOf(player))).append("Island").toString());
  894.             pi = new PlayerInfo(player);
  895.             pi.savePlayerConfig(player);
  896.         } else
  897.         {
  898.             if(Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard") && WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).hasRegion((new StringBuilder(String.valueOf(player))).append("Island").toString()))
  899.                 WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion((new StringBuilder(String.valueOf(player))).append("Island").toString());
  900.             PlayerInfo pi = new PlayerInfo(player);
  901.             removeActivePlayer(player);
  902.             addActivePlayer(player, pi);
  903.         }
  904.     }
  905.  
  906.     public boolean devSetPlayerIsland(Player sender, Location l, String player)
  907.     {
  908.         if(!getActivePlayers().containsKey(player))
  909.         {
  910.             PlayerInfo pi = new PlayerInfo(player);
  911.             int px = l.getBlockX();
  912.             int py = l.getBlockY();
  913.             int pz = l.getBlockZ();
  914.             for(int x = -10; x <= 10; x++)
  915.             {
  916.                 for(int y = -10; y <= 10; y++)
  917.                 {
  918.                     for(int z = -10; z <= 10; z++)
  919.                     {
  920.                         Block b = (new Location(l.getWorld(), px + x, py + y, pz + z)).getBlock();
  921.                         if(b.getTypeId() == 7)
  922.                         {
  923.                             pi.setHomeLocation(new Location(l.getWorld(), px + x, py + y + 3, pz + z));
  924.                             pi.setHasIsland(true);
  925.                             pi.setIslandLocation(b.getLocation());
  926.                             pi.savePlayerConfig(player);
  927.                             getInstance().createIslandConfig(pi.locationForParty(), player);
  928.                             getInstance().clearIslandConfig(pi.locationForParty(), player);
  929.                             if(Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))
  930.                                 WorldGuardHandler.protectIsland(sender, player, pi);
  931.                             getInstance().getIslandConfig(pi.locationForParty());
  932.                             return true;
  933.                         }
  934.                     }
  935.  
  936.                 }
  937.  
  938.             }
  939.  
  940.         } else
  941.         {
  942.             int px = l.getBlockX();
  943.             int py = l.getBlockY();
  944.             int pz = l.getBlockZ();
  945.             for(int x = -10; x <= 10; x++)
  946.             {
  947.                 for(int y = -10; y <= 10; y++)
  948.                 {
  949.                     for(int z = -10; z <= 10; z++)
  950.                     {
  951.                         Block b = (new Location(l.getWorld(), px + x, py + y, pz + z)).getBlock();
  952.                         if(b.getTypeId() == 7)
  953.                         {
  954.                             ((PlayerInfo)getActivePlayers().get(player)).setHomeLocation(new Location(l.getWorld(), px + x, py + y + 3, pz + z));
  955.                             ((PlayerInfo)getActivePlayers().get(player)).setHasIsland(true);
  956.                             ((PlayerInfo)getActivePlayers().get(player)).setIslandLocation(b.getLocation());
  957.                             PlayerInfo pi = (PlayerInfo)getActivePlayers().get(player);
  958.                             removeActivePlayer(player);
  959.                             addActivePlayer(player, pi);
  960.                             if(Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))
  961.                                 WorldGuardHandler.protectIsland(sender, player, pi);
  962.                             return true;
  963.                         }
  964.                     }
  965.  
  966.                 }
  967.  
  968.             }
  969.  
  970.         }
  971.         return false;
  972.     }
  973.  
  974.     public int orphanCount()
  975.     {
  976.         return orphaned.size();
  977.     }
  978.  
  979.     public void removeIsland(Location loc)
  980.     {
  981.         if(loc != null)
  982.         {
  983.             Location l = loc;
  984.             int px = l.getBlockX();
  985.             int py = l.getBlockY();
  986.             int pz = l.getBlockZ();
  987.             for(int x = (Settings.island_protectionRange / 2) * -1; x <= Settings.island_protectionRange / 2; x++)
  988.             {
  989.                 for(int y = 0; y <= 255; y++)
  990.                 {
  991.                     for(int z = (Settings.island_protectionRange / 2) * -1; z <= Settings.island_protectionRange / 2; z++)
  992.                     {
  993.                         Block b = (new Location(l.getWorld(), px + x, py + y, pz + z)).getBlock();
  994.                         if(!b.getType().equals(Material.AIR))
  995.                         {
  996.                             if(b.getType().equals(Material.CHEST))
  997.                             {
  998.                                 Chest c = (Chest)b.getState();
  999.                                 ItemStack items[] = new ItemStack[c.getInventory().getContents().length];
  1000.                                 c.getInventory().setContents(items);
  1001.                             } else
  1002.                             if(b.getType().equals(Material.FURNACE))
  1003.                             {
  1004.                                 Furnace f = (Furnace)b.getState();
  1005.                                 ItemStack items[] = new ItemStack[f.getInventory().getContents().length];
  1006.                                 f.getInventory().setContents(items);
  1007.                             } else
  1008.                             if(b.getType().equals(Material.DISPENSER))
  1009.                             {
  1010.                                 Dispenser d = (Dispenser)b.getState();
  1011.                                 ItemStack items[] = new ItemStack[d.getInventory().getContents().length];
  1012.                                 d.getInventory().setContents(items);
  1013.                             }
  1014.                             b.setType(Material.AIR);
  1015.                         }
  1016.                     }
  1017.  
  1018.                 }
  1019.  
  1020.             }
  1021.  
  1022.         }
  1023.     }
  1024.  
  1025.     public void removeIslandBlocks(Location loc)
  1026.     {
  1027.         if(loc != null)
  1028.         {
  1029.             System.out.print("Removing blocks from an abandoned island.");
  1030.             Location l = loc;
  1031.             int px = l.getBlockX();
  1032.             int py = l.getBlockY();
  1033.             int pz = l.getBlockZ();
  1034.             for(int x = -20; x <= 20; x++)
  1035.             {
  1036.                 for(int y = -20; y <= 20; y++)
  1037.                 {
  1038.                     for(int z = -20; z <= 20; z++)
  1039.                     {
  1040.                         Block b = (new Location(l.getWorld(), px + x, py + y, pz + z)).getBlock();
  1041.                         if(!b.getType().equals(Material.AIR))
  1042.                         {
  1043.                             if(b.getType().equals(Material.CHEST))
  1044.                             {
  1045.                                 Chest c = (Chest)b.getState();
  1046.                                 ItemStack items[] = new ItemStack[c.getInventory().getContents().length];
  1047.                                 c.getInventory().setContents(items);
  1048.                             } else
  1049.                             if(b.getType().equals(Material.FURNACE))
  1050.                             {
  1051.                                 Furnace f = (Furnace)b.getState();
  1052.                                 ItemStack items[] = new ItemStack[f.getInventory().getContents().length];
  1053.                                 f.getInventory().setContents(items);
  1054.                             } else
  1055.                             if(b.getType().equals(Material.DISPENSER))
  1056.                             {
  1057.                                 Dispenser d = (Dispenser)b.getState();
  1058.                                 ItemStack items[] = new ItemStack[d.getInventory().getContents().length];
  1059.                                 d.getInventory().setContents(items);
  1060.                             }
  1061.                             b.setType(Material.AIR);
  1062.                         }
  1063.                     }
  1064.  
  1065.                 }
  1066.  
  1067.             }
  1068.  
  1069.         }
  1070.     }
  1071.  
  1072.     public boolean hasParty(String playername)
  1073.     {
  1074.         if(getActivePlayers().containsKey(playername))
  1075.             return getIslandConfig(((PlayerInfo)getActivePlayers().get(playername)).locationForParty()).getInt("party.currentSize") > 1;
  1076.         PlayerInfo pi = new PlayerInfo(playername);
  1077.         if(!pi.getHasIsland())
  1078.             return false;
  1079.         return getTempIslandConfig(pi.locationForParty()).getInt("party.currentSize") > 1;
  1080.     }
  1081.  
  1082.     public Location getLastIsland()
  1083.     {
  1084.         if(lastIsland.getWorld().getName().equalsIgnoreCase(Settings.general_worldName))
  1085.         {
  1086.             return lastIsland;
  1087.         } else
  1088.         {
  1089.             setLastIsland(new Location(getSkyBlockWorld(), 0.0D, Settings.island_height, 0.0D));
  1090.             return new Location(getSkyBlockWorld(), 0.0D, Settings.island_height, 0.0D);
  1091.         }
  1092.     }
  1093.  
  1094.     public void setLastIsland(Location island)
  1095.     {
  1096.         getLastIslandConfig().set("options.general.lastIslandX", Integer.valueOf(island.getBlockX()));
  1097.         getLastIslandConfig().set("options.general.lastIslandZ", Integer.valueOf(island.getBlockZ()));
  1098.         saveLastIslandConfig();
  1099.         lastIsland = island;
  1100.     }
  1101.  
  1102.     public boolean hasOrphanedIsland()
  1103.     {
  1104.         return !orphaned.empty();
  1105.     }
  1106.  
  1107.     public Location checkOrphan()
  1108.     {
  1109.         return (Location)orphaned.peek();
  1110.     }
  1111.  
  1112.     public Location getOrphanedIsland()
  1113.     {
  1114.         if(hasOrphanedIsland())
  1115.             return (Location)orphaned.pop();
  1116.         else
  1117.             return null;
  1118.     }
  1119.  
  1120.     public void addOrphan(Location island)
  1121.     {
  1122.         orphaned.push(island);
  1123.     }
  1124.  
  1125.     public void removeNextOrphan()
  1126.     {
  1127.         orphaned.pop();
  1128.     }
  1129.  
  1130.     public void saveOrphans()
  1131.     {
  1132.         String fullOrphan = "";
  1133.         for(tempOrphaned = (Stack)orphaned.clone(); !tempOrphaned.isEmpty(); reverseOrphaned.push((Location)tempOrphaned.pop()));
  1134.         while(!reverseOrphaned.isEmpty())
  1135.         {
  1136.             Location tempLoc = (Location)reverseOrphaned.pop();
  1137.             fullOrphan = (new StringBuilder(String.valueOf(fullOrphan))).append(tempLoc.getBlockX()).append(",").append(tempLoc.getBlockZ()).append(";").toString();
  1138.         }
  1139.         getOrphans().set("orphans.list", fullOrphan);
  1140.         saveOrphansFile();
  1141.     }
  1142.  
  1143.     public void setupOrphans()
  1144.     {
  1145.         if(getOrphans().contains("orphans.list"))
  1146.         {
  1147.             String fullOrphan = getOrphans().getString("orphans.list");
  1148.             if(!fullOrphan.isEmpty())
  1149.             {
  1150.                 String orphanArray[] = fullOrphan.split(";");
  1151.                 orphaned = new Stack();
  1152.                 for(int i = 0; i < orphanArray.length; i++)
  1153.                 {
  1154.                     String orphanXY[] = orphanArray[i].split(",");
  1155.                     Location tempLoc = new Location(getSkyBlockWorld(), Integer.parseInt(orphanXY[0]), Settings.island_height, Integer.parseInt(orphanXY[1]));
  1156.                     orphaned.push(tempLoc);
  1157.                 }
  1158.  
  1159.             }
  1160.         }
  1161.     }
  1162.  
  1163.     public boolean homeTeleport(Player player)
  1164.     {
  1165.         Location homeSweetHome = null;
  1166.         if(getActivePlayers().containsKey(player.getName()))
  1167.             homeSweetHome = getInstance().getSafeHomeLocation((PlayerInfo)getActivePlayers().get(player.getName()));
  1168.         if(homeSweetHome == null)
  1169.         {
  1170.             player.performCommand("spawn");
  1171.             player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("You are not part of an island. Returning you the spawn area!").toString());
  1172.             return true;
  1173.         } else
  1174.         {
  1175.             getInstance().removeCreatures(homeSweetHome);
  1176.             player.teleport(homeSweetHome);
  1177.             player.sendMessage((new StringBuilder()).append(ChatColor.GREEN).append("Teleporting you to your island.").toString());
  1178.             return true;
  1179.         }
  1180.     }
  1181.  
  1182.     public boolean warpTeleport(Player player, PlayerInfo pi)
  1183.     {
  1184.         Location warpSweetWarp = null;
  1185.         if(pi == null)
  1186.         {
  1187.             player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("That player does not exist!").toString());
  1188.             return true;
  1189.         }
  1190.         warpSweetWarp = getInstance().getSafeWarpLocation(pi);
  1191.         if(warpSweetWarp == null)
  1192.         {
  1193.             player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("Unable to warp you to that player's island!").toString());
  1194.             return true;
  1195.         } else
  1196.         {
  1197.             player.teleport(warpSweetWarp);
  1198.             player.sendMessage((new StringBuilder()).append(ChatColor.GREEN).append("Teleporting you to ").append(pi.getPlayerName()).append("'s island.").toString());
  1199.             return true;
  1200.         }
  1201.     }
  1202.  
  1203.     public boolean homeSet(Player player)
  1204.     {
  1205.         if(!player.getWorld().getName().equalsIgnoreCase(getSkyBlockWorld().getName()))
  1206.         {
  1207.             player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("You must be closer to your island to set your skyblock home!").toString());
  1208.             return true;
  1209.         }
  1210.         if(playerIsOnIsland(player))
  1211.         {
  1212.             if(getActivePlayers().containsKey(player.getName()))
  1213.                 ((PlayerInfo)getActivePlayers().get(player.getName())).setHomeLocation(player.getLocation());
  1214.             player.sendMessage((new StringBuilder()).append(ChatColor.GREEN).append("Your skyblock home has been set to your current location.").toString());
  1215.             return true;
  1216.         } else
  1217.         {
  1218.             player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("You must be closer to your island to set your skyblock home!").toString());
  1219.             return true;
  1220.         }
  1221.     }
  1222.  
  1223.     public boolean warpSet(Player player)
  1224.     {
  1225.         if(!player.getWorld().getName().equalsIgnoreCase(getSkyBlockWorld().getName()))
  1226.         {
  1227.             player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("You must be closer to your island to set your warp!").toString());
  1228.             return true;
  1229.         }
  1230.         if(playerIsOnIsland(player))
  1231.         {
  1232.             if(getActivePlayers().containsKey(player.getName()))
  1233.                 setWarpLocation(((PlayerInfo)getActivePlayers().get(player.getName())).locationForParty(), player.getLocation());
  1234.             player.sendMessage((new StringBuilder()).append(ChatColor.GREEN).append("Your skyblock incoming warp has been set to your current location.").toString());
  1235.             return true;
  1236.         } else
  1237.         {
  1238.             player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("You must be closer to your island to set your warp!").toString());
  1239.             return true;
  1240.         }
  1241.     }
  1242.  
  1243.     public boolean homeSet(String player, Location loc)
  1244.     {
  1245.         if(getActivePlayers().containsKey(player))
  1246.         {
  1247.             ((PlayerInfo)getActivePlayers().get(player)).setHomeLocation(loc);
  1248.         } else
  1249.         {
  1250.             PlayerInfo pi = new PlayerInfo(player);
  1251.             pi.setHomeLocation(loc);
  1252.             pi.savePlayerConfig(player);
  1253.         }
  1254.         return true;
  1255.     }
  1256.  
  1257.     public boolean playerIsOnIsland(Player player)
  1258.     {
  1259.         if(getActivePlayers().containsKey(player.getName()))
  1260.         {
  1261.             if(((PlayerInfo)getActivePlayers().get(player.getName())).getHasIsland())
  1262.                 islandTestLocation = ((PlayerInfo)getActivePlayers().get(player.getName())).getIslandLocation();
  1263.             if(islandTestLocation == null)
  1264.                 return false;
  1265.             if(player.getLocation().getX() > islandTestLocation.getX() - (double)(Settings.island_protectionRange / 2) && player.getLocation().getX() < islandTestLocation.getX() + (double)(Settings.island_protectionRange / 2) && player.getLocation().getZ() > islandTestLocation.getZ() - (double)(Settings.island_protectionRange / 2) && player.getLocation().getZ() < islandTestLocation.getZ() + (double)(Settings.island_protectionRange / 2))
  1266.                 return true;
  1267.         }
  1268.         return false;
  1269.     }
  1270.  
  1271.     public boolean locationIsOnIsland(Player player, Location loc)
  1272.     {
  1273.         if(getActivePlayers().containsKey(player.getName()))
  1274.         {
  1275.             if(((PlayerInfo)getActivePlayers().get(player.getName())).getHasIsland())
  1276.                 islandTestLocation = ((PlayerInfo)getActivePlayers().get(player.getName())).getIslandLocation();
  1277.             if(islandTestLocation == null)
  1278.                 return false;
  1279.             if(loc.getX() > islandTestLocation.getX() - (double)(Settings.island_protectionRange / 2) && loc.getX() < islandTestLocation.getX() + (double)(Settings.island_protectionRange / 2) && loc.getZ() > islandTestLocation.getZ() - (double)(Settings.island_protectionRange / 2) && loc.getZ() < islandTestLocation.getZ() + (double)(Settings.island_protectionRange / 2))
  1280.                 return true;
  1281.         }
  1282.         return false;
  1283.     }
  1284.  
  1285.     public boolean playerIsInSpawn(Player player)
  1286.     {
  1287.         return player.getLocation().getX() > (double)(Settings.general_spawnSize * -1) && player.getLocation().getX() < (double)Settings.general_spawnSize && player.getLocation().getZ() > (double)(Settings.general_spawnSize * -1) && player.getLocation().getZ() < (double)Settings.general_spawnSize;
  1288.     }
  1289.  
  1290.     public boolean hasIsland(String playername)
  1291.     {
  1292.         if(getActivePlayers().containsKey(playername))
  1293.         {
  1294.             return ((PlayerInfo)getActivePlayers().get(playername)).getHasIsland();
  1295.         } else
  1296.         {
  1297.             PlayerInfo pi = new PlayerInfo(playername);
  1298.             return pi.getHasIsland();
  1299.         }
  1300.     }
  1301.  
  1302.     public Location getPlayerIsland(String playername)
  1303.     {
  1304.         if(getActivePlayers().containsKey(playername))
  1305.             return ((PlayerInfo)getActivePlayers().get(playername)).getIslandLocation();
  1306.         PlayerInfo pi = new PlayerInfo(playername);
  1307.         if(!pi.getHasIsland())
  1308.             return null;
  1309.         else
  1310.             return pi.getIslandLocation();
  1311.     }
  1312.  
  1313.     public boolean islandAtLocation(Location loc)
  1314.     {
  1315.         if(loc == null)
  1316.             return true;
  1317.         int px = loc.getBlockX();
  1318.         int py = loc.getBlockY();
  1319.         int pz = loc.getBlockZ();
  1320.         for(int x = -2; x <= 2; x++)
  1321.         {
  1322.             for(int y = -50; y <= 50; y++)
  1323.             {
  1324.                 for(int z = -2; z <= 2; z++)
  1325.                 {
  1326.                     Block b = (new Location(loc.getWorld(), px + x, py + y, pz + z)).getBlock();
  1327.                     if(b.getTypeId() != 0)
  1328.                         return true;
  1329.                 }
  1330.  
  1331.             }
  1332.  
  1333.         }
  1334.  
  1335.         return false;
  1336.     }
  1337.  
  1338.     public boolean islandInSpawn(Location loc)
  1339.     {
  1340.         if(loc == null)
  1341.             return true;
  1342.         return loc.getX() > -50D && loc.getX() < 50D && loc.getZ() > -50D && loc.getZ() < 50D;
  1343.     }
  1344.  
  1345.     public ChunkGenerator getDefaultWorldGenerator(String worldName, String id)
  1346.     {
  1347.         return new SkyBlockChunkGenerator();
  1348.     }
  1349.  
  1350.     public Stack changeStackToFile(Stack stack)
  1351.     {
  1352.         Stack finishStack = new Stack();
  1353.         Stack tempStack = new Stack();
  1354.         for(; !stack.isEmpty(); tempStack.push((Location)stack.pop()));
  1355.         while(!tempStack.isEmpty())
  1356.             if(tempStack.peek() != null)
  1357.                 finishStack.push(new SerializableLocation((Location)tempStack.pop()));
  1358.             else
  1359.                 tempStack.pop();
  1360.         return finishStack;
  1361.     }
  1362.  
  1363.     public Stack changestackfromfile(Stack stack)
  1364.     {
  1365.         Stack tempStack = new Stack();
  1366.         Stack finishStack = new Stack();
  1367.         for(; !stack.isEmpty(); tempStack.push((SerializableLocation)stack.pop()));
  1368.         while(!tempStack.isEmpty())
  1369.             if(tempStack.peek() != null)
  1370.                 finishStack.push(((SerializableLocation)tempStack.pop()).getLocation());
  1371.             else
  1372.                 tempStack.pop();
  1373.         return finishStack;
  1374.     }
  1375.  
  1376.     public boolean largeIsland(Location l)
  1377.     {
  1378.         int blockcount = 0;
  1379.         int px = l.getBlockX();
  1380.         int py = l.getBlockY();
  1381.         int pz = l.getBlockZ();
  1382.         for(int x = -30; x <= 30; x++)
  1383.         {
  1384.             for(int y = -30; y <= 30; y++)
  1385.             {
  1386.                 for(int z = -30; z <= 30; z++)
  1387.                 {
  1388.                     Block b = (new Location(l.getWorld(), px + x, py + y, pz + z)).getBlock();
  1389.                     if(b.getTypeId() != 0 && b.getTypeId() != 8 && b.getTypeId() != 10 && blockcount > 200)
  1390.                         return true;
  1391.                 }
  1392.  
  1393.             }
  1394.  
  1395.         }
  1396.  
  1397.         return blockcount > 200;
  1398.     }
  1399.  
  1400.     public boolean clearAbandoned()
  1401.     {
  1402.         int numOffline = 0;
  1403.         OfflinePlayer oplayers[] = Bukkit.getServer().getOfflinePlayers();
  1404.         System.out.print("Attemping to add more orphans");
  1405.         for(int i = 0; i < oplayers.length; i++)
  1406.         {
  1407.             long offlineTime = oplayers[i].getLastPlayed();
  1408.             offlineTime = (System.currentTimeMillis() - offlineTime) / 0x36ee80L;
  1409.             if(offlineTime > 250L && getInstance().hasIsland(oplayers[i].getName()) && offlineTime < 50000L)
  1410.             {
  1411.                 PlayerInfo pi = new PlayerInfo(oplayers[i].getName());
  1412.                 Location l = pi.getIslandLocation();
  1413.                 int blockcount = 0;
  1414.                 int px = l.getBlockX();
  1415.                 int py = l.getBlockY();
  1416.                 int pz = l.getBlockZ();
  1417.                 for(int x = -30; x <= 30; x++)
  1418.                 {
  1419.                     for(int y = -30; y <= 30; y++)
  1420.                     {
  1421.                         for(int z = -30; z <= 30; z++)
  1422.                         {
  1423.                             Block b = (new Location(l.getWorld(), px + x, py + y, pz + z)).getBlock();
  1424.                             if(b.getTypeId() != 0 && b.getTypeId() != 8 && b.getTypeId() != 10)
  1425.                                 blockcount++;
  1426.                         }
  1427.  
  1428.                     }
  1429.  
  1430.                 }
  1431.  
  1432.                 if(blockcount < 200)
  1433.                 {
  1434.                     numOffline++;
  1435.                     WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion((new StringBuilder(String.valueOf(oplayers[i].getName()))).append("Island").toString());
  1436.                     orphaned.push(pi.getIslandLocation());
  1437.                     pi.setHomeLocation(null);
  1438.                     pi.setHasIsland(false);
  1439.                     pi.setIslandLocation(null);
  1440.                     pi.savePlayerConfig(pi.getPlayerName());
  1441.                 }
  1442.             }
  1443.         }
  1444.  
  1445.         if(numOffline > 0)
  1446.         {
  1447.             System.out.print((new StringBuilder("Added ")).append(numOffline).append(" new orphans.").toString());
  1448.             saveOrphans();
  1449.             return true;
  1450.         } else
  1451.         {
  1452.             System.out.print("No new orphans to add!");
  1453.             return false;
  1454.         }
  1455.     }
  1456.  
  1457.     public LinkedHashMap generateTopTen()
  1458.     {
  1459.         HashMap tempMap = new LinkedHashMap();
  1460.         File folder = directoryIslands;
  1461.         File listOfFiles[] = folder.listFiles();
  1462.         for(int i = 0; i < listOfFiles.length; i++)
  1463.             if(getTempIslandConfig(listOfFiles[i].getName().replaceAll(".yml", "")) != null && getTempIslandConfig(listOfFiles[i].getName().replaceAll(".yml", "")).getInt("general.level") > 0)
  1464.                 tempMap.put(getTempIslandConfig(listOfFiles[i].getName().replaceAll(".yml", "")).getString("party.leader"), Double.valueOf(getTempIslandConfig(listOfFiles[i].getName().replaceAll(".yml", "")).getInt("general.level")));
  1465.  
  1466.         LinkedHashMap sortedMap = sortHashMapByValuesD(tempMap);
  1467.         return sortedMap;
  1468.     }
  1469.  
  1470.     public LinkedHashMap sortHashMapByValuesD(HashMap passedMap)
  1471.     {
  1472.         List mapKeys = new ArrayList(passedMap.keySet());
  1473.         List mapValues = new ArrayList(passedMap.values());
  1474.         Collections.sort(mapValues);
  1475.         Collections.reverse(mapValues);
  1476.         Collections.sort(mapKeys);
  1477.         Collections.reverse(mapKeys);
  1478.         LinkedHashMap sortedMap = new LinkedHashMap();
  1479.         for(Iterator valueIt = mapValues.iterator(); valueIt.hasNext();)
  1480.         {
  1481.             Double val = (Double)valueIt.next();
  1482.             for(Iterator keyIt = mapKeys.iterator(); keyIt.hasNext();)
  1483.             {
  1484.                 String key = (String)keyIt.next();
  1485.                 String comp1 = ((Double)passedMap.get(key)).toString();
  1486.                 String comp2 = val.toString();
  1487.                 if(comp1.equals(comp2))
  1488.                 {
  1489.                     passedMap.remove(key);
  1490.                     mapKeys.remove(key);
  1491.                     sortedMap.put(key, val);
  1492.                     break;
  1493.                 }
  1494.             }
  1495.  
  1496.         }
  1497.  
  1498.         return sortedMap;
  1499.     }
  1500.  
  1501.     public boolean onInfoCooldown(Player player)
  1502.     {
  1503.         if(infoCooldown.containsKey(player.getName()))
  1504.             return ((Long)infoCooldown.get(player.getName())).longValue() > Calendar.getInstance().getTimeInMillis();
  1505.         else
  1506.             return false;
  1507.     }
  1508.  
  1509.     public boolean onBiomeCooldown(Player player)
  1510.     {
  1511.         if(biomeCooldown.containsKey(player.getName()))
  1512.             return ((Long)biomeCooldown.get(player.getName())).longValue() > Calendar.getInstance().getTimeInMillis();
  1513.         else
  1514.             return false;
  1515.     }
  1516.  
  1517.     public boolean onRestartCooldown(Player player)
  1518.     {
  1519.         if(restartCooldown.containsKey(player.getName()))
  1520.             return ((Long)restartCooldown.get(player.getName())).longValue() > Calendar.getInstance().getTimeInMillis();
  1521.         else
  1522.             return false;
  1523.     }
  1524.  
  1525.     public long getInfoCooldownTime(Player player)
  1526.     {
  1527.         if(infoCooldown.containsKey(player.getName()))
  1528.         {
  1529.             if(((Long)infoCooldown.get(player.getName())).longValue() > Calendar.getInstance().getTimeInMillis())
  1530.                 return ((Long)infoCooldown.get(player.getName())).longValue() - Calendar.getInstance().getTimeInMillis();
  1531.             else
  1532.                 return 0L;
  1533.         } else
  1534.         {
  1535.             return 0L;
  1536.         }
  1537.     }
  1538.  
  1539.     public long getBiomeCooldownTime(Player player)
  1540.     {
  1541.         if(biomeCooldown.containsKey(player.getName()))
  1542.         {
  1543.             if(((Long)biomeCooldown.get(player.getName())).longValue() > Calendar.getInstance().getTimeInMillis())
  1544.                 return ((Long)biomeCooldown.get(player.getName())).longValue() - Calendar.getInstance().getTimeInMillis();
  1545.             else
  1546.                 return 0L;
  1547.         } else
  1548.         {
  1549.             return 0L;
  1550.         }
  1551.     }
  1552.  
  1553.     public long getRestartCooldownTime(Player player)
  1554.     {
  1555.         if(restartCooldown.containsKey(player.getName()))
  1556.         {
  1557.             if(((Long)restartCooldown.get(player.getName())).longValue() > Calendar.getInstance().getTimeInMillis())
  1558.                 return ((Long)restartCooldown.get(player.getName())).longValue() - Calendar.getInstance().getTimeInMillis();
  1559.             else
  1560.                 return 0L;
  1561.         } else
  1562.         {
  1563.             return 0L;
  1564.         }
  1565.     }
  1566.  
  1567.     public void setInfoCooldown(Player player)
  1568.     {
  1569.         infoCooldown.put(player.getName(), Long.valueOf(Calendar.getInstance().getTimeInMillis() + (long)(Settings.general_cooldownInfo * 1000)));
  1570.     }
  1571.  
  1572.     public void setBiomeCooldown(Player player)
  1573.     {
  1574.         biomeCooldown.put(player.getName(), Long.valueOf(Calendar.getInstance().getTimeInMillis() + (long)(Settings.general_biomeChange * 1000)));
  1575.     }
  1576.  
  1577.     public void setRestartCooldown(Player player)
  1578.     {
  1579.         restartCooldown.put(player.getName(), Long.valueOf(Calendar.getInstance().getTimeInMillis() + (long)(Settings.general_cooldownRestart * 1000)));
  1580.     }
  1581.  
  1582.     public File[] getSchemFile()
  1583.     {
  1584.         return schemFile;
  1585.     }
  1586.  
  1587.     public boolean testForObsidian(Block block)
  1588.     {
  1589.         for(int x = -3; x <= 3; x++)
  1590.         {
  1591.             for(int y = -3; y <= 3; y++)
  1592.             {
  1593.                 for(int z = -3; z <= 3; z++)
  1594.                 {
  1595.                     Block testBlock = getSkyBlockWorld().getBlockAt(block.getX() + x, block.getY() + y, block.getZ() + z);
  1596.                     if((x != 0 || y != 0 || z != 0) && testBlock.getType() == Material.OBSIDIAN)
  1597.                         return true;
  1598.                 }
  1599.  
  1600.             }
  1601.  
  1602.         }
  1603.  
  1604.         return false;
  1605.     }
  1606.  
  1607.     public void removeInactive(List removePlayerList)
  1608.     {
  1609.         getInstance().getServer().getScheduler().scheduleSyncRepeatingTask(getInstance(), new Runnable() {
  1610.  
  1611.             public void run()
  1612.             {
  1613.                 if(uSkyBlock.getInstance().getRemoveList().size() > 0 && !uSkyBlock.getInstance().isPurgeActive())
  1614.                 {
  1615.                     uSkyBlock.getInstance().deletePlayerIsland((String)uSkyBlock.getInstance().getRemoveList().get(0));
  1616.                     System.out.print((new StringBuilder("[uSkyBlock] Purge: Removing ")).append((String)uSkyBlock.getInstance().getRemoveList().get(0)).append("'s island").toString());
  1617.                     uSkyBlock.getInstance().deleteFromRemoveList();
  1618.                 }
  1619.             }
  1620.  
  1621.             final uSkyBlock this$0;
  1622.  
  1623.            
  1624.             {
  1625.                 this$0 = uSkyBlock.this;
  1626.                 super();
  1627.             }
  1628.         }
  1629. , 0L, 200L);
  1630.     }
  1631.  
  1632.     public List getRemoveList()
  1633.     {
  1634.         return removeList;
  1635.     }
  1636.  
  1637.     public void addToRemoveList(String string)
  1638.     {
  1639.         removeList.add(string);
  1640.     }
  1641.  
  1642.     public void deleteFromRemoveList()
  1643.     {
  1644.         removeList.remove(0);
  1645.     }
  1646.  
  1647.     public boolean isPurgeActive()
  1648.     {
  1649.         return purgeActive;
  1650.     }
  1651.  
  1652.     public void activatePurge()
  1653.     {
  1654.         purgeActive = true;
  1655.     }
  1656.  
  1657.     public void deactivatePurge()
  1658.     {
  1659.         purgeActive = false;
  1660.     }
  1661.  
  1662.     public HashMap getActivePlayers()
  1663.     {
  1664.         return activePlayers;
  1665.     }
  1666.  
  1667.     public void addActivePlayer(String player, PlayerInfo pi)
  1668.     {
  1669.         activePlayers.put(player, pi);
  1670.     }
  1671.  
  1672.     public void removeActivePlayer(String player)
  1673.     {
  1674.         if(activePlayers.containsKey(player))
  1675.         {
  1676.             ((PlayerInfo)activePlayers.get(player)).savePlayerConfig(player);
  1677.             activePlayers.remove(player);
  1678.             System.out.print((new StringBuilder("Removing player from memory: ")).append(player).toString());
  1679.         }
  1680.     }
  1681.  
  1682.     public void populateChallengeList()
  1683.     {
  1684.         List templist = new ArrayList();
  1685.         for(int i = 0; i < Settings.challenges_ranks.length; i++)
  1686.         {
  1687.             challenges.put(Settings.challenges_ranks[i], templist);
  1688.             templist = new ArrayList();
  1689.         }
  1690.  
  1691.         for(Iterator itr = Settings.challenges_challengeList.iterator(); itr.hasNext();)
  1692.         {
  1693.             String tempString = (String)itr.next();
  1694.             if(challenges.containsKey(getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(tempString).append(".rankLevel").toString())))
  1695.                 ((List)challenges.get(getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(tempString).append(".rankLevel").toString()))).add(tempString);
  1696.         }
  1697.  
  1698.     }
  1699.  
  1700.     public String getChallengesFromRank(Player player, String rank)
  1701.     {
  1702.         rankDisplay = (List)challenges.get(rank);
  1703.         String fullString = "";
  1704.         PlayerInfo pi = (PlayerInfo)getActivePlayers().get(player.getName());
  1705.         for(Iterator itr = rankDisplay.iterator(); itr.hasNext();)
  1706.         {
  1707.             String tempString = (String)itr.next();
  1708.             if(pi.checkChallenge(tempString) > 0)
  1709.             {
  1710.                 if(getConfig().getBoolean((new StringBuilder("options.challenges.challengeList.")).append(tempString).append(".repeatable").toString()))
  1711.                     fullString = (new StringBuilder(String.valueOf(fullString))).append(Settings.challenges_repeatableColor.replace('&', '\247')).append(tempString).append(ChatColor.DARK_GRAY).append(" - ").toString();
  1712.                 else
  1713.                     fullString = (new StringBuilder(String.valueOf(fullString))).append(Settings.challenges_finishedColor.replace('&', '\247')).append(tempString).append(ChatColor.DARK_GRAY).append(" - ").toString();
  1714.             } else
  1715.             {
  1716.                 fullString = (new StringBuilder(String.valueOf(fullString))).append(Settings.challenges_challengeColor.replace('&', '\247')).append(tempString).append(ChatColor.DARK_GRAY).append(" - ").toString();
  1717.             }
  1718.         }
  1719.  
  1720.         if(fullString.length() > 4)
  1721.             fullString = fullString.substring(0, fullString.length() - 3);
  1722.         return fullString;
  1723.     }
  1724.  
  1725.     public int checkRankCompletion(Player player, String rank)
  1726.     {
  1727.         if(!Settings.challenges_requirePreviousRank)
  1728.             return 0;
  1729.         rankDisplay = (List)challenges.get(rank);
  1730.         int ranksCompleted = 0;
  1731.         PlayerInfo pi = (PlayerInfo)getActivePlayers().get(player.getName());
  1732.         for(Iterator itr = rankDisplay.iterator(); itr.hasNext();)
  1733.         {
  1734.             String tempString = (String)itr.next();
  1735.             if(pi.checkChallenge(tempString) > 0)
  1736.                 ranksCompleted++;
  1737.         }
  1738.  
  1739.         return rankDisplay.size() - Settings.challenges_rankLeeway - ranksCompleted;
  1740.     }
  1741.  
  1742.     public boolean isRankAvailable(Player player, String rank)
  1743.     {
  1744.         if(challenges.size() < 2)
  1745.             return true;
  1746.         for(int i = 0; i < Settings.challenges_ranks.length; i++)
  1747.             if(Settings.challenges_ranks[i].equalsIgnoreCase(rank))
  1748.             {
  1749.                 if(i == 0)
  1750.                     return true;
  1751.                 if(checkRankCompletion(player, Settings.challenges_ranks[i - 1]) <= 0)
  1752.                     return true;
  1753.             }
  1754.  
  1755.         return false;
  1756.     }
  1757.  
  1758.     public boolean checkIfCanCompleteChallenge(Player player, String challenge)
  1759.     {
  1760.         PlayerInfo pi = (PlayerInfo)getActivePlayers().get(player.getName());
  1761.         if(!isRankAvailable(player, getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".rankLevel").toString())))
  1762.         {
  1763.             player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("You have not unlocked this challenge yet!").toString());
  1764.             return false;
  1765.         }
  1766.         if(!pi.challengeExists(challenge))
  1767.         {
  1768.             player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("Unknown challenge name (check spelling)!").toString());
  1769.             return false;
  1770.         }
  1771.         if(pi.checkChallenge(challenge) > 0 && !getConfig().getBoolean((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".repeatable").toString()))
  1772.         {
  1773.             player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("This challenge is not repeatable!").toString());
  1774.             return false;
  1775.         }
  1776.         if(pi.checkChallenge(challenge) > 0 && (getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".type").toString()).equalsIgnoreCase("onIsland") || getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".type").toString()).equalsIgnoreCase("onIsland")))
  1777.         {
  1778.             player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("This challenge is not repeatable!").toString());
  1779.             return false;
  1780.         }
  1781.         if(getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".type").toString()).equalsIgnoreCase("onPlayer"))
  1782.             if(!hasRequired(player, challenge, "onPlayer"))
  1783.             {
  1784.                 player.sendMessage((new StringBuilder()).append(ChatColor.RED).append(getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".description").toString())).toString());
  1785.                 player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("You don't have enough of the required item(s)!").toString());
  1786.                 return false;
  1787.             } else
  1788.             {
  1789.                 return true;
  1790.             }
  1791.         if(getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".type").toString()).equalsIgnoreCase("onIsland"))
  1792.         {
  1793.             if(!playerIsOnIsland(player))
  1794.                 player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("You must be on your island to do that!").toString());
  1795.             if(!hasRequired(player, challenge, "onIsland"))
  1796.             {
  1797.                 player.sendMessage((new StringBuilder()).append(ChatColor.RED).append(getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".description").toString())).toString());
  1798.                 player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("You must be standing within 10 blocks of all required items.").toString());
  1799.                 return false;
  1800.             } else
  1801.             {
  1802.                 return true;
  1803.             }
  1804.         }
  1805.         if(getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".type").toString()).equalsIgnoreCase("islandLevel"))
  1806.         {
  1807.             if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("general.level") >= getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".requiredItems").toString()))
  1808.             {
  1809.                 return true;
  1810.             } else
  1811.             {
  1812.                 player.sendMessage((new StringBuilder()).append(ChatColor.RED).append("Your island must be level ").append(getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".requiredItems").toString())).append(" to complete this challenge!").toString());
  1813.                 return false;
  1814.             }
  1815.         } else
  1816.         {
  1817.             return false;
  1818.         }
  1819.     }
  1820.  
  1821.     public boolean takeRequired(Player player, String challenge, String type)
  1822.     {
  1823.         if(type.equalsIgnoreCase("onPlayer"))
  1824.         {
  1825.             String reqList[] = getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".requiredItems").toString()).split(" ");
  1826.             int reqItem = 0;
  1827.             int reqAmount = 0;
  1828.             int reqMod = -1;
  1829.             String as[];
  1830.             int j = (as = reqList).length;
  1831.             for(int i = 0; i < j; i++)
  1832.             {
  1833.                 String s = as[i];
  1834.                 String sPart[] = s.split(":");
  1835.                 if(sPart.length == 2)
  1836.                 {
  1837.                     reqItem = Integer.parseInt(sPart[0]);
  1838.                     String sScale[] = sPart[1].split(";");
  1839.                     if(sScale.length == 1)
  1840.                         reqAmount = Integer.parseInt(sPart[1]);
  1841.                     else
  1842.                     if(sScale.length == 2)
  1843.                         if(sScale[1].charAt(0) == '+')
  1844.                             reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
  1845.                         else
  1846.                         if(sScale[1].charAt(0) == '*')
  1847.                             reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
  1848.                         else
  1849.                         if(sScale[1].charAt(0) == '-')
  1850.                             reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
  1851.                         else
  1852.                         if(sScale[1].charAt(0) == '/')
  1853.                             reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
  1854.                     if(!player.getInventory().contains(reqItem, reqAmount))
  1855.                         return false;
  1856.                     player.getInventory().removeItem(new ItemStack[] {
  1857.                         new ItemStack(reqItem, reqAmount)
  1858.                     });
  1859.                 } else
  1860.                 if(sPart.length == 3)
  1861.                 {
  1862.                     reqItem = Integer.parseInt(sPart[0]);
  1863.                     String sScale[] = sPart[2].split(";");
  1864.                     if(sScale.length == 1)
  1865.                         reqAmount = Integer.parseInt(sPart[2]);
  1866.                     else
  1867.                     if(sScale.length == 2)
  1868.                         if(sScale[1].charAt(0) == '+')
  1869.                             reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
  1870.                         else
  1871.                         if(sScale[1].charAt(0) == '*')
  1872.                             reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
  1873.                         else
  1874.                         if(sScale[1].charAt(0) == '-')
  1875.                             reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
  1876.                         else
  1877.                         if(sScale[1].charAt(0) == '/')
  1878.                             reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
  1879.                     reqMod = Integer.parseInt(sPart[1]);
  1880.                     if(!player.getInventory().containsAtLeast(new ItemStack(reqItem, reqAmount, (short)reqMod), reqAmount))
  1881.                         return false;
  1882.                     player.getInventory().removeItem(new ItemStack[] {
  1883.                         new ItemStack(reqItem, reqAmount, (short)reqMod)
  1884.                     });
  1885.                 }
  1886.             }
  1887.  
  1888.             return true;
  1889.         }
  1890.         if(type.equalsIgnoreCase("onIsland"))
  1891.             return true;
  1892.         return type.equalsIgnoreCase("islandLevel");
  1893.     }
  1894.  
  1895.     public boolean hasRequired(Player player, String challenge, String type)
  1896.     {
  1897.         String reqList[] = getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".requiredItems").toString()).split(" ");
  1898.         if(type.equalsIgnoreCase("onPlayer"))
  1899.         {
  1900.             int reqItem = 0;
  1901.             int reqAmount = 0;
  1902.             int reqMod = -1;
  1903.             String as[];
  1904.             int k = (as = reqList).length;
  1905.             for(int j = 0; j < k; j++)
  1906.             {
  1907.                 String s = as[j];
  1908.                 String sPart[] = s.split(":");
  1909.                 if(sPart.length == 2)
  1910.                 {
  1911.                     reqItem = Integer.parseInt(sPart[0]);
  1912.                     String sScale[] = sPart[1].split(";");
  1913.                     if(sScale.length == 1)
  1914.                         reqAmount = Integer.parseInt(sPart[1]);
  1915.                     else
  1916.                     if(sScale.length == 2)
  1917.                         if(sScale[1].charAt(0) == '+')
  1918.                             reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
  1919.                         else
  1920.                         if(sScale[1].charAt(0) == '*')
  1921.                             reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
  1922.                         else
  1923.                         if(sScale[1].charAt(0) == '-')
  1924.                             reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
  1925.                         else
  1926.                         if(sScale[1].charAt(0) == '/')
  1927.                             reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
  1928.                     if(!player.getInventory().containsAtLeast(new ItemStack(reqItem, reqAmount, (short)0), reqAmount))
  1929.                         return false;
  1930.                 } else
  1931.                 if(sPart.length == 3)
  1932.                 {
  1933.                     reqItem = Integer.parseInt(sPart[0]);
  1934.                     String sScale[] = sPart[2].split(";");
  1935.                     if(sScale.length == 1)
  1936.                         reqAmount = Integer.parseInt(sPart[2]);
  1937.                     else
  1938.                     if(sScale.length == 2)
  1939.                         if(sScale[1].charAt(0) == '+')
  1940.                             reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
  1941.                         else
  1942.                         if(sScale[1].charAt(0) == '*')
  1943.                             reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
  1944.                         else
  1945.                         if(sScale[1].charAt(0) == '-')
  1946.                             reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
  1947.                         else
  1948.                         if(sScale[1].charAt(0) == '/')
  1949.                             reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
  1950.                     reqMod = Integer.parseInt(sPart[1]);
  1951.                     if(!player.getInventory().containsAtLeast(new ItemStack(reqItem, reqAmount, (short)reqMod), reqAmount))
  1952.                         return false;
  1953.                 }
  1954.             }
  1955.  
  1956.             if(getConfig().getBoolean((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".takeItems").toString()))
  1957.                 takeRequired(player, challenge, type);
  1958.             return true;
  1959.         }
  1960.         if(type.equalsIgnoreCase("onIsland"))
  1961.         {
  1962.             int neededItem[][] = new int[reqList.length][2];
  1963.             for(int i = 0; i < reqList.length; i++)
  1964.             {
  1965.                 String sPart[] = reqList[i].split(":");
  1966.                 neededItem[i][0] = Integer.parseInt(sPart[0]);
  1967.                 neededItem[i][1] = Integer.parseInt(sPart[1]);
  1968.             }
  1969.  
  1970.             Location l = player.getLocation();
  1971.             int px = l.getBlockX();
  1972.             int py = l.getBlockY();
  1973.             int pz = l.getBlockZ();
  1974.             for(int x = -10; x <= 10; x++)
  1975.             {
  1976.                 for(int y = -3; y <= 10; y++)
  1977.                 {
  1978.                     for(int z = -10; z <= 10; z++)
  1979.                     {
  1980.                         Block b = (new Location(l.getWorld(), px + x, py + y, pz + z)).getBlock();
  1981.                         for(int i = 0; i < neededItem.length; i++)
  1982.                             if(b.getTypeId() == neededItem[i][0])
  1983.                                 neededItem[i][1]--;
  1984.  
  1985.                     }
  1986.  
  1987.                 }
  1988.  
  1989.             }
  1990.  
  1991.             for(int i = 0; i < neededItem.length; i++)
  1992.                 if(neededItem[i][1] > 0)
  1993.                     return false;
  1994.  
  1995.             return true;
  1996.         } else
  1997.         {
  1998.             return true;
  1999.         }
  2000.     }
  2001.  
  2002.     public boolean giveReward(Player player, String challenge)
  2003.     {
  2004.         String permList[] = getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge.toLowerCase()).append(".permissionReward").toString()).split(" ");
  2005.         double rewCurrency = 0.0D;
  2006.         player.sendMessage((new StringBuilder()).append(ChatColor.GREEN).append("You have completed the ").append(challenge).append(" challenge!").toString());
  2007.         String rewList[];
  2008.         if(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallenge(challenge) == 0)
  2009.         {
  2010.             rewList = getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge.toLowerCase()).append(".itemReward").toString()).split(" ");
  2011.             if(Settings.challenges_enableEconomyPlugin && VaultHandler.econ != null)
  2012.                 rewCurrency = getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge.toLowerCase()).append(".currencyReward").toString());
  2013.         } else
  2014.         {
  2015.             rewList = getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge.toLowerCase()).append(".repeatItemReward").toString()).split(" ");
  2016.             if(Settings.challenges_enableEconomyPlugin && VaultHandler.econ != null)
  2017.                 rewCurrency = getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge.toLowerCase()).append(".repeatCurrencyReward").toString());
  2018.         }
  2019.         int rewItem = 0;
  2020.         int rewAmount = 0;
  2021.         double rewBonus = 1.0D;
  2022.         int rewMod = -1;
  2023.         if(Settings.challenges_enableEconomyPlugin && VaultHandler.econ != null)
  2024.         {
  2025.             if(VaultHandler.checkPerk(player.getName(), "group.memberplus", getSkyBlockWorld()))
  2026.                 rewBonus += 0.050000000000000003D;
  2027.             if(VaultHandler.checkPerk(player.getName(), "usb.donor.all", getSkyBlockWorld()))
  2028.                 rewBonus += 0.050000000000000003D;
  2029.             if(VaultHandler.checkPerk(player.getName(), "usb.donor.25", getSkyBlockWorld()))
  2030.                 rewBonus += 0.050000000000000003D;
  2031.             if(VaultHandler.checkPerk(player.getName(), "usb.donor.50", getSkyBlockWorld()))
  2032.                 rewBonus += 0.050000000000000003D;
  2033.             if(VaultHandler.checkPerk(player.getName(), "usb.donor.75", getSkyBlockWorld()))
  2034.                 rewBonus += 0.10000000000000001D;
  2035.             if(VaultHandler.checkPerk(player.getName(), "usb.donor.100", getSkyBlockWorld()))
  2036.                 rewBonus += 0.20000000000000001D;
  2037.             VaultHandler.econ.depositPlayer(player.getName(), rewCurrency * rewBonus);
  2038.             if(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallenge(challenge) > 0)
  2039.             {
  2040.                 player.giveExp(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".repeatXpReward").toString()));
  2041.                 player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Repeat reward(s): ").append(ChatColor.WHITE).append(getInstance().getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".repeatRewardText").toString()).replace('&', '\247')).toString());
  2042.                 player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Repeat exp reward: ").append(ChatColor.WHITE).append(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".repeatXpReward").toString())).toString());
  2043.                 player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Repeat currency reward: ").append(ChatColor.WHITE).append(df.format((double)getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".repeatCurrencyReward").toString()) * rewBonus)).append(" ").append(VaultHandler.econ.currencyNamePlural()).append("\247a(+").append(df.format((rewBonus - 1.0D) * 100D)).append("%)").toString());
  2044.             } else
  2045.             {
  2046.                 if(Settings.challenges_broadcastCompletion)
  2047.                     Bukkit.getServer().broadcastMessage((new StringBuilder(String.valueOf(Settings.challenges_broadcastText.replace('&', '\247')))).append(player.getName()).append(" has completed the ").append(challenge).append(" challenge!").toString());
  2048.                 player.giveExp(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".xpReward").toString()));
  2049.                 player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Reward(s): ").append(ChatColor.WHITE).append(getInstance().getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".rewardText").toString()).replace('&', '\247')).toString());
  2050.                 player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Exp reward: ").append(ChatColor.WHITE).append(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".xpReward").toString())).toString());
  2051.                 player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Currency reward: ").append(ChatColor.WHITE).append(df.format((double)getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".currencyReward").toString()) * rewBonus)).append(" ").append(VaultHandler.econ.currencyNamePlural()).append("\247a(+").append(df.format((rewBonus - 1.0D) * 100D)).append("%)").toString());
  2052.             }
  2053.         } else
  2054.         if(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallenge(challenge) > 0)
  2055.         {
  2056.             player.giveExp(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".repeatXpReward").toString()));
  2057.             player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Repeat reward(s): ").append(ChatColor.WHITE).append(getInstance().getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".repeatRewardText").toString()).replace('&', '\247')).toString());
  2058.             player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Repeat exp reward: ").append(ChatColor.WHITE).append(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".repeatXpReward").toString())).toString());
  2059.         } else
  2060.         {
  2061.             if(Settings.challenges_broadcastCompletion)
  2062.                 Bukkit.getServer().broadcastMessage((new StringBuilder(String.valueOf(Settings.challenges_broadcastText.replace('&', '\247')))).append(player.getName()).append(" has completed the ").append(challenge).append(" challenge!").toString());
  2063.             player.giveExp(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".xpReward").toString()));
  2064.             player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Reward(s): ").append(ChatColor.WHITE).append(getInstance().getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".rewardText").toString()).replace('&', '\247')).toString());
  2065.             player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Exp reward: ").append(ChatColor.WHITE).append(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challenge).append(".xpReward").toString())).toString());
  2066.         }
  2067.         String as[];
  2068.         int k = (as = permList).length;
  2069.         for(int i = 0; i < k; i++)
  2070.         {
  2071.             String s = as[i];
  2072.             if(!s.equalsIgnoreCase("none") && !VaultHandler.checkPerk(player.getName(), s, player.getWorld()))
  2073.                 VaultHandler.addPerk(player, s);
  2074.         }
  2075.  
  2076.         k = (as = rewList).length;
  2077.         for(int j = 0; j < k; j++)
  2078.         {
  2079.             String s = as[j];
  2080.             String sPart[] = s.split(":");
  2081.             if(sPart.length == 2)
  2082.             {
  2083.                 rewItem = Integer.parseInt(sPart[0]);
  2084.                 rewAmount = Integer.parseInt(sPart[1]);
  2085.                 player.getInventory().addItem(new ItemStack[] {
  2086.                     new ItemStack(rewItem, rewAmount)
  2087.                 });
  2088.             } else
  2089.             if(sPart.length == 3)
  2090.             {
  2091.                 rewItem = Integer.parseInt(sPart[0]);
  2092.                 rewAmount = Integer.parseInt(sPart[2]);
  2093.                 rewMod = Integer.parseInt(sPart[1]);
  2094.                 player.getInventory().addItem(new ItemStack[] {
  2095.                     new ItemStack(rewItem, rewAmount, (short)rewMod)
  2096.                 });
  2097.             }
  2098.         }
  2099.  
  2100.         ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).completeChallenge(challenge);
  2101.         return true;
  2102.     }
  2103.  
  2104.     public void reloadData()
  2105.     {
  2106.         if(skyblockDataFile == null)
  2107.             skyblockDataFile = new File(getDataFolder(), "skyblockData.yml");
  2108.         skyblockData = YamlConfiguration.loadConfiguration(skyblockDataFile);
  2109.         InputStream defConfigStream = getResource("skyblockData.yml");
  2110.         if(defConfigStream != null)
  2111.         {
  2112.             YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
  2113.             skyblockData.setDefaults(defConfig);
  2114.         }
  2115.     }
  2116.  
  2117.     public FileConfiguration getData()
  2118.     {
  2119.         if(skyblockData == null)
  2120.             reloadData();
  2121.         return skyblockData;
  2122.     }
  2123.  
  2124.     double dReturns(double val, double scale)
  2125.     {
  2126.         if(val < 0.0D)
  2127.         {
  2128.             return -dReturns(-val, scale);
  2129.         } else
  2130.         {
  2131.             double mult = val / scale;
  2132.             double trinum = (Math.sqrt(8D * mult + 1.0D) - 1.0D) / 2D;
  2133.             return trinum * scale;
  2134.         }
  2135.     }
  2136.  
  2137.     public void reloadLevelConfig()
  2138.     {
  2139.         if(levelConfigFile == null)
  2140.             levelConfigFile = new File(getDataFolder(), "levelConfig.yml");
  2141.         levelConfig = YamlConfiguration.loadConfiguration(levelConfigFile);
  2142.         InputStream defConfigStream = getResource("levelConfig.yml");
  2143.         if(defConfigStream != null)
  2144.         {
  2145.             YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
  2146.             levelConfig.setDefaults(defConfig);
  2147.         }
  2148.     }
  2149.  
  2150.     public FileConfiguration getLevelConfig()
  2151.     {
  2152.         if(levelConfig == null)
  2153.             reloadLevelConfig();
  2154.         return levelConfig;
  2155.     }
  2156.  
  2157.     public void saveLevelConfig()
  2158.     {
  2159.         if(levelConfig == null || levelConfigFile == null)
  2160.             return;
  2161.         try
  2162.         {
  2163.             getLevelConfig().save(levelConfigFile);
  2164.         }
  2165.         catch(IOException ex)
  2166.         {
  2167.             getLogger().log(Level.SEVERE, (new StringBuilder("Could not save config to ")).append(levelConfigFile).toString(), ex);
  2168.         }
  2169.     }
  2170.  
  2171.     public void saveDefaultLevelConfig()
  2172.     {
  2173.         if(levelConfigFile == null)
  2174.             levelConfigFile = new File(getDataFolder(), "levelConfig.yml");
  2175.         if(!levelConfigFile.exists())
  2176.             getInstance().saveResource("levelConfig.yml", false);
  2177.     }
  2178.  
  2179.     public void loadLevelConfig()
  2180.     {
  2181.         try
  2182.         {
  2183.             getLevelConfig();
  2184.         }
  2185.         catch(Exception e)
  2186.         {
  2187.             e.printStackTrace();
  2188.         }
  2189.         for(int i = 1; i <= 255; i++)
  2190.         {
  2191.             if(getLevelConfig().contains((new StringBuilder("blockValues.")).append(i).toString()))
  2192.                 Settings.blockList[i] = getLevelConfig().getInt((new StringBuilder("blockValues.")).append(i).toString());
  2193.             else
  2194.                 Settings.blockList[i] = getLevelConfig().getInt("general.default");
  2195.             if(getLevelConfig().contains((new StringBuilder("blockLimits.")).append(i).toString()))
  2196.                 Settings.limitList[i] = getLevelConfig().getInt((new StringBuilder("blockLimits.")).append(i).toString());
  2197.             else
  2198.                 Settings.limitList[i] = -1;
  2199.             if(getLevelConfig().contains((new StringBuilder("diminishingReturns.")).append(i).toString()))
  2200.                 Settings.diminishingReturnsList[i] = getLevelConfig().getInt((new StringBuilder("diminishingReturns.")).append(i).toString());
  2201.             else
  2202.             if(getLevelConfig().getBoolean("general.useDiminishingReturns"))
  2203.                 Settings.diminishingReturnsList[i] = getLevelConfig().getInt("general.defaultScale");
  2204.             else
  2205.                 Settings.diminishingReturnsList[i] = -1;
  2206.         }
  2207.  
  2208.         System.out.print(Settings.blockList[57]);
  2209.         System.out.print(Settings.diminishingReturnsList[57]);
  2210.         System.out.print(Settings.limitList[57]);
  2211.     }
  2212.  
  2213.     public void clearIslandConfig(String location, String leader)
  2214.     {
  2215.         getIslandConfig(location).set("general.level", Integer.valueOf(0));
  2216.         getIslandConfig(location).set("general.warpLocationX", Integer.valueOf(0));
  2217.         getIslandConfig(location).set("general.warpLocationY", Integer.valueOf(0));
  2218.         getIslandConfig(location).set("general.warpLocationZ", Integer.valueOf(0));
  2219.         getIslandConfig(location).set("general.warpActive", Boolean.valueOf(false));
  2220.         getIslandConfig(location).set("log.logPos", Integer.valueOf(1));
  2221.         getIslandConfig(location).set("log.1", "\247d[skyblock] The island has been created.");
  2222.         setupPartyLeader(location, leader);
  2223.     }
  2224.  
  2225.     public void setupPartyLeader(String location, String leader)
  2226.     {
  2227.         getIslandConfig(location).createSection((new StringBuilder("party.members.")).append(leader).toString());
  2228.         getIslandConfig(location);
  2229.         FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection((new StringBuilder("party.members.")).append(leader).toString()), "canChangeBiome");
  2230.         getIslandConfig(location);
  2231.         FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection((new StringBuilder("party.members.")).append(leader).toString()), "canToggleLock");
  2232.         getIslandConfig(location);
  2233.         FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection((new StringBuilder("party.members.")).append(leader).toString()), "canChangeWarp");
  2234.         getIslandConfig(location);
  2235.         FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection((new StringBuilder("party.members.")).append(leader).toString()), "canToggleWarp");
  2236.         getIslandConfig(location);
  2237.         FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection((new StringBuilder("party.members.")).append(leader).toString()), "canInviteOthers");
  2238.         getIslandConfig(location);
  2239.         FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection((new StringBuilder("party.members.")).append(leader).toString()), "canKickOthers");
  2240.         getIslandConfig(location).set("party.leader", leader);
  2241.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(leader).append(".canChangeBiome").toString(), Boolean.valueOf(true));
  2242.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(leader).append(".canToggleLock").toString(), Boolean.valueOf(true));
  2243.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(leader).append(".canChangeWarp").toString(), Boolean.valueOf(true));
  2244.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(leader).append(".canToggleWarp").toString(), Boolean.valueOf(true));
  2245.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(leader).append(".canInviteOthers").toString(), Boolean.valueOf(true));
  2246.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(leader).append(".canKickOthers").toString(), Boolean.valueOf(true));
  2247.         saveIslandConfig(location);
  2248.     }
  2249.  
  2250.     public void setupPartyMember(String location, String member)
  2251.     {
  2252.         getIslandConfig(location).createSection((new StringBuilder("party.members.")).append(member).toString());
  2253.         getIslandConfig(location);
  2254.         FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection((new StringBuilder("party.members.")).append(member).toString()), "canChangeBiome");
  2255.         getIslandConfig(location);
  2256.         FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection((new StringBuilder("party.members.")).append(member).toString()), "canToggleLock");
  2257.         getIslandConfig(location);
  2258.         FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection((new StringBuilder("party.members.")).append(member).toString()), "canChangeWarp");
  2259.         getIslandConfig(location);
  2260.         FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection((new StringBuilder("party.members.")).append(member).toString()), "canToggleWarp");
  2261.         getIslandConfig(location);
  2262.         FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection((new StringBuilder("party.members.")).append(member).toString()), "canInviteOthers");
  2263.         getIslandConfig(location);
  2264.         FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection((new StringBuilder("party.members.")).append(member).toString()), "canKickOthers");
  2265.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(member).append(".canChangeBiome").toString(), Boolean.valueOf(false));
  2266.         getIslandConfig(location).set("party.currentSize", Integer.valueOf(getIslandConfig(location).getInt("party.currentSize") + 1));
  2267.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(member).append(".canToggleLock").toString(), Boolean.valueOf(false));
  2268.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(member).append(".canChangeWarp").toString(), Boolean.valueOf(false));
  2269.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(member).append(".canToggleWarp").toString(), Boolean.valueOf(false));
  2270.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(member).append(".canInviteOthers").toString(), Boolean.valueOf(false));
  2271.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(member).append(".canKickOthers").toString(), Boolean.valueOf(false));
  2272.         getIslandConfig(location).set((new StringBuilder("party.members.")).append(member).append(".canBanOthers").toString(), Boolean.valueOf(false));
  2273.         saveIslandConfig(location);
  2274.     }
  2275.  
  2276.     public void reloadIslandConfig(String location)
  2277.     {
  2278.         islandConfigFile = new File(directoryIslands, (new StringBuilder(String.valueOf(location))).append(".yml").toString());
  2279.         islands.put(location, YamlConfiguration.loadConfiguration(islandConfigFile));
  2280.         InputStream defConfigStream = getResource("island.yml");
  2281.         if(defConfigStream != null)
  2282.         {
  2283.             YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
  2284.             ((FileConfiguration)islands.get(location)).setDefaults(defConfig);
  2285.         }
  2286.         saveIslandConfig(location);
  2287.     }
  2288.  
  2289.     public FileConfiguration getTempIslandConfig(String location)
  2290.     {
  2291.         tempIslandFile = new File(directoryIslands, (new StringBuilder(String.valueOf(location))).append(".yml").toString());
  2292.         tempIsland = YamlConfiguration.loadConfiguration(tempIslandFile);
  2293.         return tempIsland;
  2294.     }
  2295.  
  2296.     public FileConfiguration getCurrentPlayerConfig(String player)
  2297.     {
  2298.         tempPlayerFile = new File(directoryPlayers, (new StringBuilder(String.valueOf(player))).append(".yml").toString());
  2299.         tempPlayer = YamlConfiguration.loadConfiguration(tempPlayerFile);
  2300.         return tempPlayer;
  2301.     }
  2302.  
  2303.     public void createIslandConfig(String location, String leader)
  2304.     {
  2305.         saveDefaultIslandsConfig(location);
  2306.         islandConfigFile = new File(directoryIslands, (new StringBuilder(String.valueOf(location))).append(".yml").toString());
  2307.         InputStream defConfigStream = getResource("island.yml");
  2308.         if(defConfigStream != null)
  2309.         {
  2310.             islands.put(location, YamlConfiguration.loadConfiguration(defConfigStream));
  2311.             getIslandConfig(location);
  2312.             setupPartyLeader(location, leader);
  2313.         }
  2314.     }
  2315.  
  2316.     public FileConfiguration getIslandConfig(String location)
  2317.     {
  2318.         if(islands.get(location) == null)
  2319.             reloadIslandConfig(location);
  2320.         return (FileConfiguration)islands.get(location);
  2321.     }
  2322.  
  2323.     public void saveIslandConfig(String location)
  2324.     {
  2325.         if(islands.get(location) == null)
  2326.             return;
  2327.         try
  2328.         {
  2329.             islandConfigFile = new File(directoryIslands, (new StringBuilder(String.valueOf(location))).append(".yml").toString());
  2330.             getIslandConfig(location).save(islandConfigFile);
  2331.         }
  2332.         catch(IOException ex)
  2333.         {
  2334.             getLogger().log(Level.SEVERE, (new StringBuilder("Could not save config to ")).append(islandConfigFile).toString(), ex);
  2335.         }
  2336.     }
  2337.  
  2338.     public void deleteIslandConfig(String location)
  2339.     {
  2340.         islandConfigFile = new File(directoryIslands, (new StringBuilder(String.valueOf(location))).append(".yml").toString());
  2341.         islandConfigFile.delete();
  2342.     }
  2343.  
  2344.     public void saveDefaultIslandsConfig(String location)
  2345.     {
  2346.         try
  2347.         {
  2348.             if(islandConfigFile == null)
  2349.             {
  2350.                 islandConfigFile = new File(directoryIslands, (new StringBuilder(String.valueOf(location))).append(".yml").toString());
  2351.                 getIslandConfig(location).save(islandConfigFile);
  2352.             }
  2353.         }
  2354.         catch(IOException ex)
  2355.         {
  2356.             getLogger().log(Level.SEVERE, (new StringBuilder("Could not save config to ")).append(islandConfigFile).toString(), ex);
  2357.         }
  2358.     }
  2359.  
  2360.     public void reloadLastIslandConfig()
  2361.     {
  2362.         if(lastIslandConfigFile == null)
  2363.             lastIslandConfigFile = new File(getDataFolder(), "lastIslandConfig.yml");
  2364.         lastIslandConfig = YamlConfiguration.loadConfiguration(lastIslandConfigFile);
  2365.         InputStream defConfigStream = getResource("lastIslandConfig.yml");
  2366.         if(defConfigStream != null)
  2367.         {
  2368.             YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
  2369.             lastIslandConfig.setDefaults(defConfig);
  2370.         }
  2371.     }
  2372.  
  2373.     public FileConfiguration getLastIslandConfig()
  2374.     {
  2375.         if(lastIslandConfig == null)
  2376.             reloadLastIslandConfig();
  2377.         return lastIslandConfig;
  2378.     }
  2379.  
  2380.     public void saveLastIslandConfig()
  2381.     {
  2382.         if(lastIslandConfig == null || lastIslandConfigFile == null)
  2383.             return;
  2384.         try
  2385.         {
  2386.             getLastIslandConfig().save(lastIslandConfigFile);
  2387.         }
  2388.         catch(IOException ex)
  2389.         {
  2390.             getLogger().log(Level.SEVERE, (new StringBuilder("Could not save config to ")).append(lastIslandConfigFile).toString(), ex);
  2391.         }
  2392.     }
  2393.  
  2394.     public void saveDefaultLastIslandConfig()
  2395.     {
  2396.         if(lastIslandConfigFile == null)
  2397.             lastIslandConfigFile = new File(getDataFolder(), "lastIslandConfig.yml");
  2398.         if(!lastIslandConfigFile.exists())
  2399.             getInstance().saveResource("lastIslandConfig.yml", false);
  2400.     }
  2401.  
  2402.     public void reloadOrphans()
  2403.     {
  2404.         if(orphanFile == null)
  2405.             orphanFile = new File(getDataFolder(), "orphans.yml");
  2406.         orphans = YamlConfiguration.loadConfiguration(orphanFile);
  2407.         InputStream defConfigStream = getResource("orphans.yml");
  2408.         if(defConfigStream != null)
  2409.         {
  2410.             YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
  2411.             orphans.setDefaults(defConfig);
  2412.         }
  2413.     }
  2414.  
  2415.     public FileConfiguration getOrphans()
  2416.     {
  2417.         if(orphans == null)
  2418.             reloadOrphans();
  2419.         return orphans;
  2420.     }
  2421.  
  2422.     public void saveOrphansFile()
  2423.     {
  2424.         if(orphans == null || orphanFile == null)
  2425.             return;
  2426.         try
  2427.         {
  2428.             getOrphans().save(orphanFile);
  2429.         }
  2430.         catch(IOException ex)
  2431.         {
  2432.             getLogger().log(Level.SEVERE, (new StringBuilder("Could not save config to ")).append(orphanFile).toString(), ex);
  2433.         }
  2434.     }
  2435.  
  2436.     public void saveDefaultOrphans()
  2437.     {
  2438.         if(orphanFile == null)
  2439.             orphanFile = new File(getDataFolder(), "orphans.yml");
  2440.         if(!orphanFile.exists())
  2441.             getInstance().saveResource("orphans.yml", false);
  2442.     }
  2443.  
  2444.     public boolean setBiome(Location loc, String bName)
  2445.     {
  2446.         int px = loc.getBlockX();
  2447.         int pz = loc.getBlockZ();
  2448.         Biome bType = Biome.OCEAN;
  2449.         if(bName.equalsIgnoreCase("jungle"))
  2450.             bType = Biome.JUNGLE;
  2451.         else
  2452.         if(bName.equalsIgnoreCase("hell"))
  2453.             bType = Biome.HELL;
  2454.         else
  2455.         if(bName.equalsIgnoreCase("sky"))
  2456.             bType = Biome.SKY;
  2457.         else
  2458.         if(bName.equalsIgnoreCase("mushroom"))
  2459.             bType = Biome.MUSHROOM_ISLAND;
  2460.         else
  2461.         if(bName.equalsIgnoreCase("ocean"))
  2462.             bType = Biome.OCEAN;
  2463.         else
  2464.         if(bName.equalsIgnoreCase("swampland"))
  2465.             bType = Biome.SWAMPLAND;
  2466.         else
  2467.         if(bName.equalsIgnoreCase("taiga"))
  2468.             bType = Biome.TAIGA;
  2469.         else
  2470.         if(bName.equalsIgnoreCase("desert"))
  2471.             bType = Biome.DESERT;
  2472.         else
  2473.         if(bName.equalsIgnoreCase("forest"))
  2474.             bType = Biome.FOREST;
  2475.         else
  2476.             bType = Biome.OCEAN;
  2477.         for(int x = (Settings.island_protectionRange / 2) * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16)
  2478.         {
  2479.             for(int z = (Settings.island_protectionRange / 2) * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16)
  2480.                 getSkyBlockWorld().loadChunk((px + x) / 16, (pz + z) / 16);
  2481.  
  2482.         }
  2483.  
  2484.         for(int x = (Settings.island_protectionRange / 2) * -1; x <= Settings.island_protectionRange / 2; x++)
  2485.         {
  2486.             for(int z = (Settings.island_protectionRange / 2) * -1; z <= Settings.island_protectionRange / 2; z++)
  2487.                 getSkyBlockWorld().setBiome(px + x, pz + z, bType);
  2488.  
  2489.         }
  2490.  
  2491.         for(int x = (Settings.island_protectionRange / 2) * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16)
  2492.         {
  2493.             for(int z = (Settings.island_protectionRange / 2) * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16)
  2494.                 getSkyBlockWorld().refreshChunk((px + x) / 16, (pz + z) / 16);
  2495.  
  2496.         }
  2497.  
  2498.         return bType != Biome.OCEAN;
  2499.     }
  2500.  
  2501.     public boolean changePlayerBiome(Player player, String bName)
  2502.     {
  2503.         if(VaultHandler.checkPerk(player.getName(), (new StringBuilder("usb.biome.")).append(bName).toString(), player.getWorld()))
  2504.         {
  2505.             if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(player.getName()).append(".canChangeBiome").toString()))
  2506.             {
  2507.                 setBiome(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).getIslandLocation(), bName);
  2508.                 setConfigBiome(player, bName);
  2509.                 return true;
  2510.             } else
  2511.             {
  2512.                 return false;
  2513.             }
  2514.         } else
  2515.         {
  2516.             return false;
  2517.         }
  2518.     }
  2519.  
  2520.     public void listBiomes(Player player)
  2521.     {
  2522.         String biomeList = ", ";
  2523.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.ocean", getSkyBlockWorld()))
  2524.             biomeList = "OCEAN, ";
  2525.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.forest", getSkyBlockWorld()))
  2526.             biomeList = (new StringBuilder(String.valueOf(biomeList))).append("FOREST, ").toString();
  2527.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.jungle", getSkyBlockWorld()))
  2528.             biomeList = (new StringBuilder(String.valueOf(biomeList))).append("JUNGLE, ").toString();
  2529.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.desert", getSkyBlockWorld()))
  2530.             biomeList = (new StringBuilder(String.valueOf(biomeList))).append("DESERT, ").toString();
  2531.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.taiga", getSkyBlockWorld()))
  2532.             biomeList = (new StringBuilder(String.valueOf(biomeList))).append("TAIGA, ").toString();
  2533.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.swampland", getSkyBlockWorld()))
  2534.             biomeList = (new StringBuilder(String.valueOf(biomeList))).append("SWAMPLAND, ").toString();
  2535.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.mushroom", getSkyBlockWorld()))
  2536.             biomeList = (new StringBuilder(String.valueOf(biomeList))).append("MUSHROOM, ").toString();
  2537.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.hell", getSkyBlockWorld()))
  2538.             biomeList = (new StringBuilder(String.valueOf(biomeList))).append("HELL, ").toString();
  2539.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.sky", getSkyBlockWorld()))
  2540.             biomeList = (new StringBuilder(String.valueOf(biomeList))).append("SKY, ").toString();
  2541.         player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("You have access to the following Biomes:").toString());
  2542.         player.sendMessage((new StringBuilder()).append(ChatColor.GREEN).append(biomeList.substring(0, biomeList.length() - 2)).toString());
  2543.         player.sendMessage((new StringBuilder()).append(ChatColor.YELLOW).append("Use /island biome <biomename> to change your biome. You must wait ").append(Settings.general_biomeChange / 60).append(" minutes between each biome change.").toString());
  2544.     }
  2545.  
  2546.     public boolean createIsland(CommandSender sender, PlayerInfo pi)
  2547.     {
  2548.         System.out.println("Creating player island...");
  2549.         Player player = (Player)sender;
  2550.         Location last = getInstance().getLastIsland();
  2551.         last.setY(Settings.island_height);
  2552.         try
  2553.         {
  2554.             for(; getInstance().hasOrphanedIsland() && getInstance().islandAtLocation(getInstance().checkOrphan()); getInstance().removeNextOrphan());
  2555.             for(; getInstance().hasOrphanedIsland() && !getInstance().checkOrphan().getWorld().getName().equalsIgnoreCase(Settings.general_worldName); getInstance().removeNextOrphan());
  2556.             Location next;
  2557.             if(getInstance().hasOrphanedIsland() && !getInstance().islandAtLocation(getInstance().checkOrphan()))
  2558.             {
  2559.                 next = getInstance().getOrphanedIsland();
  2560.                 getInstance().saveOrphans();
  2561.             } else
  2562.             {
  2563.                 next = nextIslandLocation(last);
  2564.                 getInstance().setLastIsland(next);
  2565.                 for(; getInstance().islandAtLocation(next); next = nextIslandLocation(next));
  2566.                 for(; getInstance().islandInSpawn(next); next = nextIslandLocation(next));
  2567.                 getInstance().setLastIsland(next);
  2568.             }
  2569.             boolean hasIslandNow = false;
  2570.             if(getInstance().getSchemFile().length > 0 && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldEdit"))
  2571.             {
  2572.                 String cSchem = "";
  2573.                 for(int i = 0; i < getInstance().getSchemFile().length; i++)
  2574.                     if(!hasIslandNow)
  2575.                     {
  2576.                         if(getInstance().getSchemFile()[i].getName().lastIndexOf('.') > 0)
  2577.                             cSchem = getInstance().getSchemFile()[i].getName().substring(0, getInstance().getSchemFile()[i].getName().lastIndexOf('.'));
  2578.                         else
  2579.                             cSchem = getInstance().getSchemFile()[i].getName();
  2580.                         if(VaultHandler.checkPerk(player.getName(), (new StringBuilder("usb.schematic.")).append(cSchem).toString(), getSkyBlockWorld()) && WorldEditHandler.loadIslandSchematic(getSkyBlockWorld(), getInstance().getSchemFile()[i], next))
  2581.                         {
  2582.                             setChest(next, player);
  2583.                             hasIslandNow = true;
  2584.                         }
  2585.                     }
  2586.  
  2587.                 if(!hasIslandNow)
  2588.                 {
  2589.                     for(int i = 0; i < getInstance().getSchemFile().length; i++)
  2590.                     {
  2591.                         if(getInstance().getSchemFile()[i].getName().lastIndexOf('.') > 0)
  2592.                             cSchem = getInstance().getSchemFile()[i].getName().substring(0, getInstance().getSchemFile()[i].getName().lastIndexOf('.'));
  2593.                         else
  2594.                             cSchem = getInstance().getSchemFile()[i].getName();
  2595.                         if(cSchem.equalsIgnoreCase(Settings.island_schematicName) && WorldEditHandler.loadIslandSchematic(getSkyBlockWorld(), getInstance().getSchemFile()[i], next))
  2596.                         {
  2597.                             setChest(next, player);
  2598.                             hasIslandNow = true;
  2599.                         }
  2600.                     }
  2601.  
  2602.                 }
  2603.             }
  2604.             if(!hasIslandNow)
  2605.                 if(!Settings.island_useOldIslands)
  2606.                     generateIslandBlocks(next.getBlockX(), next.getBlockZ(), player, getSkyBlockWorld());
  2607.                 else
  2608.                     oldGenerateIslandBlocks(next.getBlockX(), next.getBlockZ(), player, getSkyBlockWorld());
  2609.             next.setY(Settings.island_height);
  2610.             System.out.println(next.getBlockY());
  2611.             System.out.println("Preparing to set new player information...");
  2612.             setNewPlayerIsland(player, next);
  2613.             System.out.println("Finished setting new player information.");
  2614.             player.getInventory().clear();
  2615.             player.getEquipment().clear();
  2616.             System.out.println("Preparing to set initial player biome...");
  2617.             getInstance().changePlayerBiome(player, "OCEAN");
  2618.             System.out.println("Finished setting initial player biome.");
  2619.             for(int x = (Settings.island_protectionRange / 2) * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16)
  2620.             {
  2621.                 for(int z = (Settings.island_protectionRange / 2) * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16)
  2622.                     getSkyBlockWorld().refreshChunk((next.getBlockX() + x) / 16, (next.getBlockZ() + z) / 16);
  2623.  
  2624.             }
  2625.  
  2626.             for(Iterator ents = player.getNearbyEntities(50D, 250D, 50D).iterator(); ents.hasNext();)
  2627.             {
  2628.                 Entity tempent = (Entity)ents.next();
  2629.                 if(!(tempent instanceof Player))
  2630.                     tempent.remove();
  2631.             }
  2632.  
  2633.             if(Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))
  2634.                 WorldGuardHandler.protectIsland(player, sender.getName(), pi);
  2635.         }
  2636.         catch(Exception ex)
  2637.         {
  2638.             player.sendMessage("Could not create your Island. Pleace contact a server moderator.");
  2639.             ex.printStackTrace();
  2640.             return false;
  2641.         }
  2642.         System.out.println("Finished creating player island.");
  2643.         return true;
  2644.     }
  2645.  
  2646.     public void generateIslandBlocks(int x, int z, Player player, World world)
  2647.     {
  2648.         int y = Settings.island_height;
  2649.         Block blockToChange = world.getBlockAt(x, y, z);
  2650.         blockToChange.setTypeId(7);
  2651.         islandLayer1(x, z, player, world);
  2652.         islandLayer2(x, z, player, world);
  2653.         islandLayer3(x, z, player, world);
  2654.         islandLayer4(x, z, player, world);
  2655.         islandExtras(x, z, player, world);
  2656.     }
  2657.  
  2658.     public void oldGenerateIslandBlocks(int x, int z, Player player, World world)
  2659.     {
  2660.         int y = Settings.island_height;
  2661.         for(int x_operate = x; x_operate < x + 3; x_operate++)
  2662.         {
  2663.             for(int y_operate = y; y_operate < y + 3; y_operate++)
  2664.             {
  2665.                 for(int z_operate = z; z_operate < z + 6; z_operate++)
  2666.                 {
  2667.                     Block blockToChange = world.getBlockAt(x_operate, y_operate, z_operate);
  2668.                     blockToChange.setTypeId(2);
  2669.                 }
  2670.  
  2671.             }
  2672.  
  2673.         }
  2674.  
  2675.         for(int x_operate = x + 3; x_operate < x + 6; x_operate++)
  2676.         {
  2677.             for(int y_operate = y; y_operate < y + 3; y_operate++)
  2678.             {
  2679.                 for(int z_operate = z + 3; z_operate < z + 6; z_operate++)
  2680.                 {
  2681.                     Block blockToChange = world.getBlockAt(x_operate, y_operate, z_operate);
  2682.                     blockToChange.setTypeId(2);
  2683.                 }
  2684.  
  2685.             }
  2686.  
  2687.         }
  2688.  
  2689.         for(int x_operate = x + 3; x_operate < x + 7; x_operate++)
  2690.         {
  2691.             for(int y_operate = y + 7; y_operate < y + 10; y_operate++)
  2692.             {
  2693.                 for(int z_operate = z + 3; z_operate < z + 7; z_operate++)
  2694.                 {
  2695.                     Block blockToChange = world.getBlockAt(x_operate, y_operate, z_operate);
  2696.                     blockToChange.setTypeId(18);
  2697.                 }
  2698.  
  2699.             }
  2700.  
  2701.         }
  2702.  
  2703.         for(int y_operate = y + 3; y_operate < y + 9; y_operate++)
  2704.         {
  2705.             Block blockToChange = world.getBlockAt(x + 5, y_operate, z + 5);
  2706.             blockToChange.setTypeId(17);
  2707.         }
  2708.  
  2709.         Block blockToChange = world.getBlockAt(x + 1, y + 3, z + 1);
  2710.         blockToChange.setTypeId(54);
  2711.         Chest chest = (Chest)blockToChange.getState();
  2712.         Inventory inventory = chest.getInventory();
  2713.         inventory.clear();
  2714.         inventory.setContents(Settings.island_chestItems);
  2715.         if(Settings.island_addExtraItems)
  2716.         {
  2717.             for(int i = 0; i < Settings.island_extraPermissions.length; i++)
  2718.                 if(VaultHandler.checkPerk(player.getName(), (new StringBuilder("usb.")).append(Settings.island_extraPermissions[i]).toString(), player.getWorld()))
  2719.                 {
  2720.                     String chestItemString[] = getInstance().getConfig().getString((new StringBuilder("options.island.extraPermissions.")).append(Settings.island_extraPermissions[i]).toString()).split(" ");
  2721.                     ItemStack tempChest[] = new ItemStack[chestItemString.length];
  2722.                     String amountdata[] = new String[2];
  2723.                     for(int j = 0; j < chestItemString.length; j++)
  2724.                     {
  2725.                         amountdata = chestItemString[j].split(":");
  2726.                         tempChest[j] = new ItemStack(Integer.parseInt(amountdata[0]), Integer.parseInt(amountdata[1]));
  2727.                         inventory.addItem(new ItemStack[] {
  2728.                             tempChest[j]
  2729.                         });
  2730.                     }
  2731.  
  2732.                 }
  2733.  
  2734.         }
  2735.         blockToChange = world.getBlockAt(x, y, z);
  2736.         blockToChange.setTypeId(7);
  2737.         blockToChange = world.getBlockAt(x + 2, y + 1, z + 1);
  2738.         blockToChange.setTypeId(12);
  2739.         blockToChange = world.getBlockAt(x + 2, y + 1, z + 2);
  2740.         blockToChange.setTypeId(12);
  2741.         blockToChange = world.getBlockAt(x + 2, y + 1, z + 3);
  2742.         blockToChange.setTypeId(12);
  2743.     }
  2744.  
  2745.     private Location nextIslandLocation(Location lastIsland)
  2746.     {
  2747.         int x = (int)lastIsland.getX();
  2748.         int z = (int)lastIsland.getZ();
  2749.         Location nextPos = lastIsland;
  2750.         if(x < z)
  2751.             if(-1 * x < z)
  2752.             {
  2753.                 nextPos.setX(nextPos.getX() + (double)Settings.island_distance);
  2754.                 return nextPos;
  2755.             } else
  2756.             {
  2757.                 nextPos.setZ(nextPos.getZ() + (double)Settings.island_distance);
  2758.                 return nextPos;
  2759.             }
  2760.         if(x > z)
  2761.             if(-1 * x >= z)
  2762.             {
  2763.                 nextPos.setX(nextPos.getX() - (double)Settings.island_distance);
  2764.                 return nextPos;
  2765.             } else
  2766.             {
  2767.                 nextPos.setZ(nextPos.getZ() - (double)Settings.island_distance);
  2768.                 return nextPos;
  2769.             }
  2770.         if(x <= 0)
  2771.         {
  2772.             nextPos.setZ(nextPos.getZ() + (double)Settings.island_distance);
  2773.             return nextPos;
  2774.         } else
  2775.         {
  2776.             nextPos.setZ(nextPos.getZ() - (double)Settings.island_distance);
  2777.             return nextPos;
  2778.         }
  2779.     }
  2780.  
  2781.     private void islandLayer1(int x, int z, Player player, World world)
  2782.     {
  2783.         int y = Settings.island_height;
  2784.         y = Settings.island_height + 4;
  2785.         for(int x_operate = x - 3; x_operate <= x + 3; x_operate++)
  2786.         {
  2787.             for(int z_operate = z - 3; z_operate <= z + 3; z_operate++)
  2788.             {
  2789.                 Block blockToChange = world.getBlockAt(x_operate, y, z_operate);
  2790.                 blockToChange.setTypeId(2);
  2791.             }
  2792.  
  2793.         }
  2794.  
  2795.         Block blockToChange = world.getBlockAt(x - 3, y, z + 3);
  2796.         blockToChange.setTypeId(0);
  2797.         blockToChange = world.getBlockAt(x - 3, y, z - 3);
  2798.         blockToChange.setTypeId(0);
  2799.         blockToChange = world.getBlockAt(x + 3, y, z - 3);
  2800.         blockToChange.setTypeId(0);
  2801.         blockToChange = world.getBlockAt(x + 3, y, z + 3);
  2802.         blockToChange.setTypeId(0);
  2803.     }
  2804.  
  2805.     private void islandLayer2(int x, int z, Player player, World world)
  2806.     {
  2807.         int y = Settings.island_height;
  2808.         y = Settings.island_height + 3;
  2809.         for(int x_operate = x - 2; x_operate <= x + 2; x_operate++)
  2810.         {
  2811.             for(int z_operate = z - 2; z_operate <= z + 2; z_operate++)
  2812.             {
  2813.                 Block blockToChange = world.getBlockAt(x_operate, y, z_operate);
  2814.                 blockToChange.setTypeId(3);
  2815.             }
  2816.  
  2817.         }
  2818.  
  2819.         Block blockToChange = world.getBlockAt(x - 3, y, z);
  2820.         blockToChange.setTypeId(3);
  2821.         blockToChange = world.getBlockAt(x + 3, y, z);
  2822.         blockToChange.setTypeId(3);
  2823.         blockToChange = world.getBlockAt(x, y, z - 3);
  2824.         blockToChange.setTypeId(3);
  2825.         blockToChange = world.getBlockAt(x, y, z + 3);
  2826.         blockToChange.setTypeId(3);
  2827.         blockToChange = world.getBlockAt(x, y, z);
  2828.         blockToChange.setTypeId(12);
  2829.     }
  2830.  
  2831.     private void islandLayer3(int x, int z, Player player, World world)
  2832.     {
  2833.         int y = Settings.island_height;
  2834.         y = Settings.island_height + 2;
  2835.         for(int x_operate = x - 1; x_operate <= x + 1; x_operate++)
  2836.         {
  2837.             for(int z_operate = z - 1; z_operate <= z + 1; z_operate++)
  2838.             {
  2839.                 Block blockToChange = world.getBlockAt(x_operate, y, z_operate);
  2840.                 blockToChange.setTypeId(3);
  2841.             }
  2842.  
  2843.         }
  2844.  
  2845.         Block blockToChange = world.getBlockAt(x - 2, y, z);
  2846.         blockToChange.setTypeId(3);
  2847.         blockToChange = world.getBlockAt(x + 2, y, z);
  2848.         blockToChange.setTypeId(3);
  2849.         blockToChange = world.getBlockAt(x, y, z - 2);
  2850.         blockToChange.setTypeId(3);
  2851.         blockToChange = world.getBlockAt(x, y, z + 2);
  2852.         blockToChange.setTypeId(3);
  2853.         blockToChange = world.getBlockAt(x, y, z);
  2854.         blockToChange.setTypeId(12);
  2855.     }
  2856.  
  2857.     private void islandLayer4(int x, int z, Player player, World world)
  2858.     {
  2859.         int y = Settings.island_height;
  2860.         y = Settings.island_height + 1;
  2861.         Block blockToChange = world.getBlockAt(x - 1, y, z);
  2862.         blockToChange.setTypeId(3);
  2863.         blockToChange = world.getBlockAt(x + 1, y, z);
  2864.         blockToChange.setTypeId(3);
  2865.         blockToChange = world.getBlockAt(x, y, z - 1);
  2866.         blockToChange.setTypeId(3);
  2867.         blockToChange = world.getBlockAt(x, y, z + 1);
  2868.         blockToChange.setTypeId(3);
  2869.         blockToChange = world.getBlockAt(x, y, z);
  2870.         blockToChange.setTypeId(12);
  2871.     }
  2872.  
  2873.     private void islandExtras(int x, int z, Player player, World world)
  2874.     {
  2875.         int y = Settings.island_height;
  2876.         Block blockToChange = world.getBlockAt(x, y + 5, z);
  2877.         blockToChange.setTypeId(17);
  2878.         blockToChange = world.getBlockAt(x, y + 6, z);
  2879.         blockToChange.setTypeId(17);
  2880.         blockToChange = world.getBlockAt(x, y + 7, z);
  2881.         blockToChange.setTypeId(17);
  2882.         y = Settings.island_height + 8;
  2883.         for(int x_operate = x - 2; x_operate <= x + 2; x_operate++)
  2884.         {
  2885.             for(int z_operate = z - 2; z_operate <= z + 2; z_operate++)
  2886.             {
  2887.                 blockToChange = world.getBlockAt(x_operate, y, z_operate);
  2888.                 blockToChange.setTypeId(18);
  2889.             }
  2890.  
  2891.         }
  2892.  
  2893.         blockToChange = world.getBlockAt(x + 2, y, z + 2);
  2894.         blockToChange.setTypeId(0);
  2895.         blockToChange = world.getBlockAt(x + 2, y, z - 2);
  2896.         blockToChange.setTypeId(0);
  2897.         blockToChange = world.getBlockAt(x - 2, y, z + 2);
  2898.         blockToChange.setTypeId(0);
  2899.         blockToChange = world.getBlockAt(x - 2, y, z - 2);
  2900.         blockToChange.setTypeId(0);
  2901.         blockToChange = world.getBlockAt(x, y, z);
  2902.         blockToChange.setTypeId(17);
  2903.         y = Settings.island_height + 9;
  2904.         for(int x_operate = x - 1; x_operate <= x + 1; x_operate++)
  2905.         {
  2906.             for(int z_operate = z - 1; z_operate <= z + 1; z_operate++)
  2907.             {
  2908.                 blockToChange = world.getBlockAt(x_operate, y, z_operate);
  2909.                 blockToChange.setTypeId(18);
  2910.             }
  2911.  
  2912.         }
  2913.  
  2914.         blockToChange = world.getBlockAt(x - 2, y, z);
  2915.         blockToChange.setTypeId(18);
  2916.         blockToChange = world.getBlockAt(x + 2, y, z);
  2917.         blockToChange.setTypeId(18);
  2918.         blockToChange = world.getBlockAt(x, y, z - 2);
  2919.         blockToChange.setTypeId(18);
  2920.         blockToChange = world.getBlockAt(x, y, z + 2);
  2921.         blockToChange.setTypeId(18);
  2922.         blockToChange = world.getBlockAt(x, y, z);
  2923.         blockToChange.setTypeId(17);
  2924.         y = Settings.island_height + 10;
  2925.         blockToChange = world.getBlockAt(x - 1, y, z);
  2926.         blockToChange.setTypeId(18);
  2927.         blockToChange = world.getBlockAt(x + 1, y, z);
  2928.         blockToChange.setTypeId(18);
  2929.         blockToChange = world.getBlockAt(x, y, z - 1);
  2930.         blockToChange.setTypeId(18);
  2931.         blockToChange = world.getBlockAt(x, y, z + 1);
  2932.         blockToChange.setTypeId(18);
  2933.         blockToChange = world.getBlockAt(x, y, z);
  2934.         blockToChange.setTypeId(17);
  2935.         blockToChange = world.getBlockAt(x, y + 1, z);
  2936.         blockToChange.setTypeId(18);
  2937.         blockToChange = world.getBlockAt(x, Settings.island_height + 5, z + 1);
  2938.         blockToChange.setTypeId(54);
  2939.         Chest chest = (Chest)blockToChange.getState();
  2940.         Inventory inventory = chest.getInventory();
  2941.         inventory.clear();
  2942.         inventory.setContents(Settings.island_chestItems);
  2943.         if(Settings.island_addExtraItems)
  2944.         {
  2945.             for(int i = 0; i < Settings.island_extraPermissions.length; i++)
  2946.                 if(VaultHandler.checkPerk(player.getName(), (new StringBuilder("usb.")).append(Settings.island_extraPermissions[i]).toString(), player.getWorld()))
  2947.                 {
  2948.                     String chestItemString[] = getInstance().getConfig().getString((new StringBuilder("options.island.extraPermissions.")).append(Settings.island_extraPermissions[i]).toString()).split(" ");
  2949.                     ItemStack tempChest[] = new ItemStack[chestItemString.length];
  2950.                     String amountdata[] = new String[2];
  2951.                     for(int j = 0; j < chestItemString.length; j++)
  2952.                     {
  2953.                         amountdata = chestItemString[j].split(":");
  2954.                         tempChest[j] = new ItemStack(Integer.parseInt(amountdata[0]), Integer.parseInt(amountdata[1]));
  2955.                         inventory.addItem(new ItemStack[] {
  2956.                             tempChest[j]
  2957.                         });
  2958.                     }
  2959.  
  2960.                 }
  2961.  
  2962.         }
  2963.     }
  2964.  
  2965.     public void setChest(Location loc, Player player)
  2966.     {
  2967.         for(int x = -15; x <= 15; x++)
  2968.         {
  2969.             for(int y = -15; y <= 15; y++)
  2970.             {
  2971.                 for(int z = -15; z <= 15; z++)
  2972.                     if(getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z).getTypeId() == 54)
  2973.                     {
  2974.                         Block blockToChange = getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z);
  2975.                         Chest chest = (Chest)blockToChange.getState();
  2976.                         Inventory inventory = chest.getInventory();
  2977.                         inventory.clear();
  2978.                         inventory.setContents(Settings.island_chestItems);
  2979.                         if(Settings.island_addExtraItems)
  2980.                         {
  2981.                             for(int i = 0; i < Settings.island_extraPermissions.length; i++)
  2982.                                 if(VaultHandler.checkPerk(player.getName(), (new StringBuilder("usb.")).append(Settings.island_extraPermissions[i]).toString(), player.getWorld()))
  2983.                                 {
  2984.                                     String chestItemString[] = getInstance().getConfig().getString((new StringBuilder("options.island.extraPermissions.")).append(Settings.island_extraPermissions[i]).toString()).split(" ");
  2985.                                     ItemStack tempChest[] = new ItemStack[chestItemString.length];
  2986.                                     String amountdata[] = new String[2];
  2987.                                     for(int j = 0; j < chestItemString.length; j++)
  2988.                                     {
  2989.                                         amountdata = chestItemString[j].split(":");
  2990.                                         tempChest[j] = new ItemStack(Integer.parseInt(amountdata[0]), Integer.parseInt(amountdata[1]));
  2991.                                         inventory.addItem(new ItemStack[] {
  2992.                                             tempChest[j]
  2993.                                         });
  2994.                                     }
  2995.  
  2996.                                 }
  2997.  
  2998.                         }
  2999.                     }
  3000.  
  3001.             }
  3002.  
  3003.         }
  3004.  
  3005.     }
  3006.  
  3007.     public Location getChestSpawnLoc(Location loc, Player player)
  3008.     {
  3009.         for(int x = -15; x <= 15; x++)
  3010.         {
  3011.             for(int y = -15; y <= 15; y++)
  3012.             {
  3013.                 for(int z = -15; z <= 15; z++)
  3014.                     if(getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z).getTypeId() == 54)
  3015.                     {
  3016.                         if(getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + (z + 1)).getTypeId() == 0 && getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + (y - 1), loc.getBlockZ() + (z + 1)).getTypeId() != 0)
  3017.                             return new Location(getSkyBlockWorld(), loc.getBlockX() + x, loc.getBlockY() + (y + 1), loc.getBlockZ() + (z + 1));
  3018.                         if(getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + (z - 1)).getTypeId() == 0 && getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + (y - 1), loc.getBlockZ() + (z - 1)).getTypeId() != 0)
  3019.                             return new Location(getSkyBlockWorld(), loc.getBlockX() + x, loc.getBlockY() + (y + 1), loc.getBlockZ() + (z + 1));
  3020.                         if(getSkyBlockWorld().getBlockAt(loc.getBlockX() + (x + 1), loc.getBlockY() + y, loc.getBlockZ() + z).getTypeId() == 0 && getSkyBlockWorld().getBlockAt(loc.getBlockX() + (x + 1), loc.getBlockY() + (y - 1), loc.getBlockZ() + z).getTypeId() != 0)
  3021.                             return new Location(getSkyBlockWorld(), loc.getBlockX() + x, loc.getBlockY() + (y + 1), loc.getBlockZ() + (z + 1));
  3022.                         if(getSkyBlockWorld().getBlockAt(loc.getBlockX() + (x - 1), loc.getBlockY() + y, loc.getBlockZ() + z).getTypeId() == 0 && getSkyBlockWorld().getBlockAt(loc.getBlockX() + (x - 1), loc.getBlockY() + (y - 1), loc.getBlockZ() + z).getTypeId() != 0)
  3023.                         {
  3024.                             return new Location(getSkyBlockWorld(), loc.getBlockX() + x, loc.getBlockY() + (y + 1), loc.getBlockZ() + (z + 1));
  3025.                         } else
  3026.                         {
  3027.                             loc.setY(loc.getY() + 1.0D);
  3028.                             return loc;
  3029.                         }
  3030.                     }
  3031.  
  3032.             }
  3033.  
  3034.         }
  3035.  
  3036.         return loc;
  3037.     }
  3038.  
  3039.     private void setNewPlayerIsland(Player player, Location loc)
  3040.     {
  3041.         ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).startNewIsland(loc);
  3042.         player.teleport(getChestSpawnLoc(loc, player));
  3043.         if(getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()) == null)
  3044.             createIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty(), player.getName());
  3045.         clearIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty(), player.getName());
  3046.         getInstance().updatePartyNumber(player);
  3047.         getInstance().homeSet(player);
  3048.         ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).savePlayerConfig(player.getName());
  3049.     }
  3050.  
  3051.     public void setWarpLocation(String location, Location loc)
  3052.     {
  3053.         getIslandConfig(location).set("general.warpLocationX", Integer.valueOf(loc.getBlockX()));
  3054.         getIslandConfig(location).set("general.warpLocationY", Integer.valueOf(loc.getBlockY()));
  3055.         getIslandConfig(location).set("general.warpLocationZ", Integer.valueOf(loc.getBlockZ()));
  3056.         getIslandConfig(location).set("general.warpActive", Boolean.valueOf(true));
  3057.         saveIslandConfig(location);
  3058.     }
  3059.  
  3060.     public void buildIslandList()
  3061.     {
  3062.         File folder = getInstance().directoryPlayers;
  3063.         File listOfFiles[] = folder.listFiles();
  3064.         System.out.print((new StringBuilder()).append(ChatColor.YELLOW).append("[uSkyBlock] Building a new island list...").toString());
  3065.         for(int i = 0; i < listOfFiles.length; i++)
  3066.         {
  3067.             PlayerInfo pi = new PlayerInfo(listOfFiles[i].getName());
  3068.             if(pi.getHasIsland())
  3069.             {
  3070.                 System.out.print((new StringBuilder("Creating new island file for ")).append(pi.getPlayerName()).toString());
  3071.                 createIslandConfig(pi.locationForParty(), pi.getPlayerName());
  3072.                 saveIslandConfig(pi.locationForParty());
  3073.             }
  3074.         }
  3075.  
  3076.         for(int i = 0; i < listOfFiles.length; i++)
  3077.         {
  3078.             PlayerInfo pi = new PlayerInfo(listOfFiles[i].getName());
  3079.             if(!pi.getHasIsland() && pi.getPartyIslandLocation() != null && getTempIslandConfig(pi.locationForPartyOld()) != null && !getTempIslandConfig(pi.locationForPartyOld()).contains((new StringBuilder("party.members.")).append(pi.getPlayerName()).toString()))
  3080.             {
  3081.                 setupPartyMember(pi.locationForPartyOld(), pi.getPlayerName());
  3082.                 saveIslandConfig(pi.locationForParty());
  3083.             }
  3084.         }
  3085.  
  3086.         System.out.print((new StringBuilder()).append(ChatColor.YELLOW).append("[uSkyBlock] Party list completed.").toString());
  3087.     }
  3088.  
  3089.     public void removeIslandConfig(String location)
  3090.     {
  3091.         islands.remove(location);
  3092.     }
  3093.  
  3094.     public void displayIslandConfigs()
  3095.     {
  3096.         for(Iterator islandList = islands.keySet().iterator(); islandList.hasNext(); System.out.print((String)islandList.next()));
  3097.     }
  3098.  
  3099.     public void updatePartyNumber(Player player)
  3100.     {
  3101.         if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize") < 8 && VaultHandler.checkPerk(player.getName(), "usb.extra.partysize", player.getWorld()))
  3102.         {
  3103.             getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).set("party.maxSize", Integer.valueOf(8));
  3104.             getInstance().saveIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty());
  3105.             return;
  3106.         }
  3107.         if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize") < 7 && VaultHandler.checkPerk(player.getName(), "usb.extra.party3", player.getWorld()))
  3108.         {
  3109.             getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).set("party.maxSize", Integer.valueOf(7));
  3110.             getInstance().saveIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty());
  3111.             return;
  3112.         }
  3113.         if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize") < 6 && VaultHandler.checkPerk(player.getName(), "usb.extra.party2", player.getWorld()))
  3114.         {
  3115.             getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).set("party.maxSize", Integer.valueOf(6));
  3116.             getInstance().saveIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty());
  3117.             return;
  3118.         }
  3119.         if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize") < 5 && VaultHandler.checkPerk(player.getName(), "usb.extra.party1", player.getWorld()))
  3120.         {
  3121.             getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).set("party.maxSize", Integer.valueOf(5));
  3122.             getInstance().saveIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty());
  3123.             return;
  3124.         } else
  3125.         {
  3126.             return;
  3127.         }
  3128.     }
  3129.  
  3130.     public void changePlayerPermission(Player player, String playername, String perm)
  3131.     {
  3132.         if(!getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).contains((new StringBuilder("party.members.")).append(playername).append(".").append(perm).toString()))
  3133.             return;
  3134.         if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(playername).append(".").append(perm).toString()))
  3135.             getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).set((new StringBuilder("party.members.")).append(playername).append(".").append(perm).toString(), Boolean.valueOf(false));
  3136.         else
  3137.             getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).set((new StringBuilder("party.members.")).append(playername).append(".").append(perm).toString(), Boolean.valueOf(true));
  3138.         getInstance().saveIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty());
  3139.     }
  3140.  
  3141.     public boolean checkForOnlineMembers(Player p)
  3142.     {
  3143.         for(Iterator temp = getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(p.getName())).locationForParty()).getConfigurationSection("party.members").getKeys(false).iterator(); temp.hasNext();)
  3144.         {
  3145.             String tString = (String)temp.next();
  3146.             if(Bukkit.getPlayer(tString) != null && !Bukkit.getPlayer(tString).getName().equalsIgnoreCase(p.getName()))
  3147.                 return true;
  3148.         }
  3149.  
  3150.         return false;
  3151.     }
  3152.  
  3153.     public boolean checkCurrentBiome(Player p, String biome)
  3154.     {
  3155.         return getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(p.getName())).locationForParty()).getString("general.biome").equalsIgnoreCase(biome);
  3156.     }
  3157.  
  3158.     public void setConfigBiome(Player p, String biome)
  3159.     {
  3160.         getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(p.getName())).locationForParty()).set("general.biome", biome);
  3161.         getInstance().saveIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(p.getName())).locationForParty());
  3162.     }
  3163.  
  3164.     public Inventory displayPartyPlayerGUI(Player player, String pname)
  3165.     {
  3166.         GUIpartyPlayer = Bukkit.createInventory(null, 9, (new StringBuilder(String.valueOf(pname))).append(" <Permissions>").toString());
  3167.         ItemStack pHead = new ItemStack(397, 1, (short)3);
  3168.         SkullMeta meta3 = (SkullMeta)pHead.getItemMeta();
  3169.         ItemMeta meta4 = sign.getItemMeta();
  3170.         meta4.setDisplayName("\247hPlayer Permissions");
  3171.         lores.add("\247eClick here to return to");
  3172.         lores.add("\247eyour island group's info.");
  3173.         meta4.setLore(lores);
  3174.         sign.setItemMeta(meta4);
  3175.         GUIpartyPlayer.addItem(new ItemStack[] {
  3176.             sign
  3177.         });
  3178.         lores.clear();
  3179.         meta3.setDisplayName((new StringBuilder(String.valueOf(pname))).append("'s Permissions").toString());
  3180.         lores.add("\247eHover over an icon to view");
  3181.         lores.add("\247ea permission. Change the");
  3182.         lores.add("\247epermission by clicking it.");
  3183.         meta3.setLore(lores);
  3184.         pHead.setItemMeta(meta3);
  3185.         GUIpartyPlayer.addItem(new ItemStack[] {
  3186.             pHead
  3187.         });
  3188.         lores.clear();
  3189.         meta4 = biome.getItemMeta();
  3190.         if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(pname).append(".canChangeBiome").toString()))
  3191.         {
  3192.             meta4.setDisplayName("\247aChange Biome");
  3193.             lores.add("\247fThis player \247acan\247f change the");
  3194.             lores.add("\247fisland's biome. Click here");
  3195.             lores.add("\247fto remove this permission.");
  3196.         } else
  3197.         {
  3198.             meta4.setDisplayName("\247cChange Biome");
  3199.             lores.add("\247fThis player \247ccannot\247f change the");
  3200.             lores.add("\247fisland's biome. Click here");
  3201.             lores.add("\247fto grant this permission.");
  3202.         }
  3203.         meta4.setLore(lores);
  3204.         biome.setItemMeta(meta4);
  3205.         GUIpartyPlayer.addItem(new ItemStack[] {
  3206.             biome
  3207.         });
  3208.         lores.clear();
  3209.         meta4 = lock.getItemMeta();
  3210.         if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(pname).append(".canToggleLock").toString()))
  3211.         {
  3212.             meta4.setDisplayName("\247aToggle Island Lock");
  3213.             lores.add("\247fThis player \247acan\247f toggle the");
  3214.             lores.add("\247fisland's lock, which prevents");
  3215.             lores.add("\247fnon-group members from entering.");
  3216.             lores.add("\247fClick here to remove this permission.");
  3217.         } else
  3218.         {
  3219.             meta4.setDisplayName("\247cToggle Island Lock");
  3220.             lores.add("\247fThis player \247ccannot\247f toggle the");
  3221.             lores.add("\247fisland's lock, which prevents");
  3222.             lores.add("\247fnon-group members from entering.");
  3223.             lores.add("\247fClick here to add this permission");
  3224.         }
  3225.         meta4.setLore(lores);
  3226.         lock.setItemMeta(meta4);
  3227.         GUIpartyPlayer.addItem(new ItemStack[] {
  3228.             lock
  3229.         });
  3230.         lores.clear();
  3231.         meta4 = warpset.getItemMeta();
  3232.         if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(pname).append(".canChangeWarp").toString()))
  3233.         {
  3234.             meta4.setDisplayName("\247aSet Island Warp");
  3235.             lores.add("\247fThis player \247acan\247f set the");
  3236.             lores.add("\247fisland's warp, which allows");
  3237.             lores.add("\247fnon-group members to teleport");
  3238.             lores.add("\247fto the island. Click here to");
  3239.             lores.add("\247fremove this permission.");
  3240.         } else
  3241.         {
  3242.             meta4.setDisplayName("\247cSet Island Warp");
  3243.             lores.add("\247fThis player \247ccannot\247f set the");
  3244.             lores.add("\247fisland's warp, which allows");
  3245.             lores.add("\247fnon-group members to teleport");
  3246.             lores.add("\247fto the island. Click here to");
  3247.             lores.add("\247fadd this permission.");
  3248.         }
  3249.         meta4.setLore(lores);
  3250.         warpset.setItemMeta(meta4);
  3251.         GUIpartyPlayer.addItem(new ItemStack[] {
  3252.             warpset
  3253.         });
  3254.         lores.clear();
  3255.         meta4 = warptoggle.getItemMeta();
  3256.         if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(pname).append(".canToggleWarp").toString()))
  3257.         {
  3258.             meta4.setDisplayName("\247aToggle Island Warp");
  3259.             lores.add("\247fThis player \247acan\247f toggle the");
  3260.             lores.add("\247fisland's warp, allowing them");
  3261.             lores.add("\247fto turn it on or off at anytime.");
  3262.             lores.add("\247fbut not set the location. Click");
  3263.             lores.add("\247fhere to remove this permission.");
  3264.         } else
  3265.         {
  3266.             meta4.setDisplayName("\247cToggle Island Warp");
  3267.             lores.add("\247fThis player \247ccannot\247f toggle the");
  3268.             lores.add("\247fisland's warp, allowing them");
  3269.             lores.add("\247fto turn it on or off at anytime,");
  3270.             lores.add("\247fbut not set the location. Click");
  3271.             lores.add("\247fhere to add this permission.");
  3272.         }
  3273.         meta4.setLore(lores);
  3274.         warptoggle.setItemMeta(meta4);
  3275.         GUIpartyPlayer.addItem(new ItemStack[] {
  3276.             warptoggle
  3277.         });
  3278.         lores.clear();
  3279.         meta4 = invite.getItemMeta();
  3280.         if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(pname).append(".canInviteOthers").toString()))
  3281.         {
  3282.             meta4.setDisplayName("\247aInvite Players");
  3283.             lores.add("\247fThis player \247acan\247f invite");
  3284.             lores.add("\247fother players to the island if");
  3285.             lores.add("\247fthere is enough room for more");
  3286.             lores.add("\247fmembers. Click here to remove");
  3287.             lores.add("\247fthis permission.");
  3288.         } else
  3289.         {
  3290.             meta4.setDisplayName("\247cInvite Players");
  3291.             lores.add("\247fThis player \247ccannot\247f invite");
  3292.             lores.add("\247fother players to the island.");
  3293.             lores.add("\247fClick here to add this permission.");
  3294.         }
  3295.         meta4.setLore(lores);
  3296.         invite.setItemMeta(meta4);
  3297.         GUIpartyPlayer.addItem(new ItemStack[] {
  3298.             invite
  3299.         });
  3300.         lores.clear();
  3301.         meta4 = kick.getItemMeta();
  3302.         if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(pname).append(".canKickOthers").toString()))
  3303.         {
  3304.             meta4.setDisplayName("\247aKick Players");
  3305.             lores.add("\247fThis player \247acan\247f kick");
  3306.             lores.add("\247fother players from the island,");
  3307.             lores.add("\247fbut they are unable to kick");
  3308.             lores.add("\247fthe island leader. Click here");
  3309.             lores.add("\247fto remove this permission.");
  3310.         } else
  3311.         {
  3312.             meta4.setDisplayName("\247cKick Players");
  3313.             lores.add("\247fThis player \247ccannot\247f kick");
  3314.             lores.add("\247fother players from the island.");
  3315.             lores.add("\247fClick here to add this permission.");
  3316.         }
  3317.         meta4.setLore(lores);
  3318.         kick.setItemMeta(meta4);
  3319.         GUIpartyPlayer.addItem(new ItemStack[] {
  3320.             kick
  3321.         });
  3322.         lores.clear();
  3323.         return GUIpartyPlayer;
  3324.     }
  3325.  
  3326.     public Inventory displayPartyGUI(Player player)
  3327.     {
  3328.         GUIparty = Bukkit.createInventory(null, 18, "\2479Island Group Members");
  3329.         Set memberList = getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getConfigurationSection("party.members").getKeys(false);
  3330.         tempIt = memberList.iterator();
  3331.         SkullMeta meta3 = (SkullMeta)pHead.getItemMeta();
  3332.         ItemMeta meta4 = sign.getItemMeta();
  3333.         meta4.setDisplayName("\247aGroup Info");
  3334.         lores.add((new StringBuilder("Group Members: \2472")).append(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.currentSize")).append("\2477/\247e").append(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize")).toString());
  3335.         if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.currentSize") < getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize"))
  3336.             lores.add("\247aMore players can be invited to this island.");
  3337.         else
  3338.             lores.add("\247cThis island is full.");
  3339.         lores.add("\247eHover over a player's icon to");
  3340.         lores.add("\247eview their permissions. The");
  3341.         lores.add("\247eleader can change permissions");
  3342.         lores.add("\247eby clicking a player's icon.");
  3343.         meta4.setLore(lores);
  3344.         sign.setItemMeta(meta4);
  3345.         GUIparty.addItem(new ItemStack[] {
  3346.             sign
  3347.         });
  3348.         lores.clear();
  3349.         for(; tempIt.hasNext(); GUIparty.addItem(new ItemStack[] {
  3350.     pHead
  3351. }))
  3352.         {
  3353.             String temp = (String)tempIt.next();
  3354.             if(temp.equalsIgnoreCase(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getString("party.leader")))
  3355.             {
  3356.                 meta3.setDisplayName((new StringBuilder("\247f")).append(temp).toString());
  3357.                 lores.add("\247a\247lLeader");
  3358.                 lores.add("\247aCan \247fchange the island's biome.");
  3359.                 lores.add("\247aCan \247flock/unlock the island.");
  3360.                 lores.add("\247aCan \247fset the island's warp.");
  3361.                 lores.add("\247aCan \247ftoggle the island's warp.");
  3362.                 lores.add("\247aCan \247finvite others to the island.");
  3363.                 lores.add("\247aCan \247fkick others from the island.");
  3364.                 meta3.setLore(lores);
  3365.                 lores.clear();
  3366.             } else
  3367.             {
  3368.                 meta3.setDisplayName((new StringBuilder("\247f")).append(temp).toString());
  3369.                 lores.add("\247e\247lMember");
  3370.                 if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(temp).append(".canChangeBiome").toString()))
  3371.                     lores.add("\247aCan \247fchange the island's biome.");
  3372.                 else
  3373.                     lores.add("\247cCannot \247fchange the island's biome.");
  3374.                 if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(temp).append(".canToggleLock").toString()))
  3375.                     lores.add("\247aCan \247flock/unlock the island.");
  3376.                 else
  3377.                     lores.add("\247cCannot \247flock/unlock the island.");
  3378.                 if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(temp).append(".canChangeWarp").toString()))
  3379.                     lores.add("\247aCan \247fset the island's warp.");
  3380.                 else
  3381.                     lores.add("\247cCannot \247fset the island's warp.");
  3382.                 if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(temp).append(".canToggleWarp").toString()))
  3383.                     lores.add("\247aCan \247ftoggle the island's warp.");
  3384.                 else
  3385.                     lores.add("\247cCannot \247ftoggle the island's warp.");
  3386.                 if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(temp).append(".canInviteOthers").toString()))
  3387.                     lores.add("\247aCan \247finvite others to the island.");
  3388.                 else
  3389.                     lores.add("\247cCannot \247finvite others to the island.");
  3390.                 if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(temp).append(".canKickOthers").toString()))
  3391.                     lores.add("\247aCan \247fkick others from the island.");
  3392.                 else
  3393.                     lores.add("\247cCannot \247fkick others from the island.");
  3394.                 if(player.getName().equalsIgnoreCase(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getString("party.leader")))
  3395.                     lores.add("\247e<Click to change this player's permissions>");
  3396.                 meta3.setLore(lores);
  3397.                 lores.clear();
  3398.             }
  3399.             meta3.setOwner(temp);
  3400.             pHead.setItemMeta(meta3);
  3401.         }
  3402.  
  3403.         return GUIparty;
  3404.     }
  3405.  
  3406.     public Inventory displayLogGUI(Player player)
  3407.     {
  3408.         GUIlog = Bukkit.createInventory(null, 9, "\2479Island Log");
  3409.         ItemMeta meta4 = sign.getItemMeta();
  3410.         meta4.setDisplayName("\247lIsland Log");
  3411.         lores.add("\247eClick here to return to");
  3412.         lores.add("\247ethe main island screen.");
  3413.         meta4.setLore(lores);
  3414.         sign.setItemMeta(meta4);
  3415.         GUIlog.addItem(new ItemStack[] {
  3416.             sign
  3417.         });
  3418.         lores.clear();
  3419.         currentLogItem = new ItemStack(Material.BOOK_AND_QUILL, 1);
  3420.         meta4 = currentLogItem.getItemMeta();
  3421.         meta4.setDisplayName("\247e\247lIsland Log");
  3422.         for(int i = 1; i <= 10; i++)
  3423.             if(getInstance().getIslandConfig(((PlayerInfo)getActivePlayers().get(player.getName())).locationForParty()).contains((new StringBuilder("log.")).append(i).toString()))
  3424.                 lores.add(getInstance().getIslandConfig(((PlayerInfo)getActivePlayers().get(player.getName())).locationForParty()).getString((new StringBuilder("log.")).append(i).toString()));
  3425.  
  3426.         meta4.setLore(lores);
  3427.         currentLogItem.setItemMeta(meta4);
  3428.         GUIlog.setItem(8, currentLogItem);
  3429.         lores.clear();
  3430.         return GUIlog;
  3431.     }
  3432.  
  3433.     public Inventory displayBiomeGUI(Player player)
  3434.     {
  3435.         GUIbiome = Bukkit.createInventory(null, 18, "\2479Island Biome");
  3436.         ItemMeta meta4 = sign.getItemMeta();
  3437.         meta4.setDisplayName("\247hIsland Biome");
  3438.         lores.add("\247eClick here to return to");
  3439.         lores.add("\247ethe main island screen.");
  3440.         meta4.setLore(lores);
  3441.         sign.setItemMeta(meta4);
  3442.         GUIbiome.addItem(new ItemStack[] {
  3443.             sign
  3444.         });
  3445.         lores.clear();
  3446.         currentBiomeItem = new ItemStack(Material.WATER, 1);
  3447.         meta4 = currentBiomeItem.getItemMeta();
  3448.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.ocean", player.getWorld()))
  3449.         {
  3450.             meta4.setDisplayName("\247aBiome: Ocean");
  3451.             lores.add("\247fThe ocean biome is the basic");
  3452.             lores.add("\247fstarting biome for all islands.");
  3453.             lores.add("\247fpassive mobs like animals will");
  3454.             lores.add("\247fnot spawn. Hostile mobs will");
  3455.             lores.add("\247fspawn normally.");
  3456.             if(checkCurrentBiome(player, "OCEAN"))
  3457.                 lores.add("\2472\247lThis is your current biome.");
  3458.             else
  3459.                 lores.add("\247e\247lClick to change to this biome.");
  3460.         } else
  3461.         {
  3462.             meta4.setDisplayName("\2478Biome: Ocean");
  3463.             lores.add("\247cYou cannot use this biome.");
  3464.             lores.add("\2477The ocean biome is the basic");
  3465.             lores.add("\2477starting biome for all islands.");
  3466.             lores.add("\2477passive mobs like animals will");
  3467.             lores.add("\2477not spawn. Hostile mobs will");
  3468.             lores.add("\2477spawn normally.");
  3469.         }
  3470.         meta4.setLore(lores);
  3471.         currentBiomeItem.setItemMeta(meta4);
  3472.         GUIbiome.addItem(new ItemStack[] {
  3473.             currentBiomeItem
  3474.         });
  3475.         lores.clear();
  3476.         currentBiomeItem = new ItemStack(Material.SAPLING, 1, (short)1);
  3477.         meta4 = currentBiomeItem.getItemMeta();
  3478.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.forst", player.getWorld()))
  3479.         {
  3480.             meta4.setDisplayName("\247aBiome: Forest");
  3481.             lores.add("\247fThe forest biome will allow");
  3482.             lores.add("\247fyour island to spawn passive.");
  3483.             lores.add("\247fmobs like animals (including");
  3484.             lores.add("\247fwolves). Hostile mobs will");
  3485.             lores.add("\247fspawn normally.");
  3486.             if(checkCurrentBiome(player, "FOREST"))
  3487.                 lores.add("\2472\247lThis is your current biome.");
  3488.             else
  3489.                 lores.add("\247e\247lClick to change to this biome.");
  3490.         } else
  3491.         {
  3492.             meta4.setDisplayName("\2478Biome: Forest");
  3493.             lores.add("\247cYou cannot use this biome.");
  3494.             lores.add("\2477The forest biome will allow");
  3495.             lores.add("\2477your island to spawn passive.");
  3496.             lores.add("\2477mobs like animals (including");
  3497.             lores.add("\2477wolves). Hostile mobs will");
  3498.             lores.add("\2477spawn normally.");
  3499.         }
  3500.         meta4.setLore(lores);
  3501.         currentBiomeItem.setItemMeta(meta4);
  3502.         GUIbiome.addItem(new ItemStack[] {
  3503.             currentBiomeItem
  3504.         });
  3505.         lores.clear();
  3506.         currentBiomeItem = new ItemStack(Material.SAND, 1);
  3507.         meta4 = currentBiomeItem.getItemMeta();
  3508.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.desert", player.getWorld()))
  3509.         {
  3510.             meta4.setDisplayName("\247aBiome: Desert");
  3511.             lores.add("\247fThe desert biome makes it so");
  3512.             lores.add("\247fthat there is no rain or snow");
  3513.             lores.add("\247fon your island. Passive mobs");
  3514.             lores.add("\247fwon't spawn. Hostile mobs will");
  3515.             lores.add("\247fspawn normally.");
  3516.             if(checkCurrentBiome(player, "DESERT"))
  3517.                 lores.add("\2472\247lThis is your current biome.");
  3518.             else
  3519.                 lores.add("\247e\247lClick to change to this biome.");
  3520.         } else
  3521.         {
  3522.             meta4.setDisplayName("\2478Biome: Desert");
  3523.             lores.add("\247cYou cannot use this biome.");
  3524.             lores.add("\2477The desert biome makes it so");
  3525.             lores.add("\2477that there is no rain or snow");
  3526.             lores.add("\2477on your island. Passive mobs");
  3527.             lores.add("\2477won't spawn. Hostile mobs will");
  3528.             lores.add("\2477spawn normally.");
  3529.         }
  3530.         meta4.setLore(lores);
  3531.         currentBiomeItem.setItemMeta(meta4);
  3532.         GUIbiome.addItem(new ItemStack[] {
  3533.             currentBiomeItem
  3534.         });
  3535.         lores.clear();
  3536.         currentBiomeItem = new ItemStack(Material.SAPLING, 1, (short)3);
  3537.         meta4 = currentBiomeItem.getItemMeta();
  3538.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.jungle", player.getWorld()))
  3539.         {
  3540.             meta4.setDisplayName("\247aBiome: Jungle");
  3541.             lores.add("\247fThe jungle biome is bright");
  3542.             lores.add("\247fand colorful. Passive mobs");
  3543.             lores.add("\247f(including ocelots) will");
  3544.             lores.add("\247fspawn. Hostile mobs will");
  3545.             lores.add("\247fspawn normally.");
  3546.             if(checkCurrentBiome(player, "JUNGLE"))
  3547.                 lores.add("\2472\247lThis is your current biome.");
  3548.             else
  3549.                 lores.add("\247e\247lClick to change to this biome.");
  3550.         } else
  3551.         {
  3552.             meta4.setDisplayName("\2478Biome: Jungle");
  3553.             lores.add("\247cYou cannot use this biome.");
  3554.             lores.add("\2477The jungle biome is bright");
  3555.             lores.add("\2477and colorful. Passive mobs");
  3556.             lores.add("\2477(including ocelots) will");
  3557.             lores.add("\2477spawn. Hostile mobs will");
  3558.             lores.add("\2477spawn normally.");
  3559.         }
  3560.         meta4.setLore(lores);
  3561.         currentBiomeItem.setItemMeta(meta4);
  3562.         GUIbiome.addItem(new ItemStack[] {
  3563.             currentBiomeItem
  3564.         });
  3565.         lores.clear();
  3566.         currentBiomeItem = new ItemStack(Material.WATER_LILY, 1);
  3567.         meta4 = currentBiomeItem.getItemMeta();
  3568.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.swampland", player.getWorld()))
  3569.         {
  3570.             meta4.setDisplayName("\247aBiome: Swampland");
  3571.             lores.add("\247fThe swamp biome is dark");
  3572.             lores.add("\247fand dull. Passive mobs");
  3573.             lores.add("\247fwill spawn normally and");
  3574.             lores.add("\247fslimes have a small chance");
  3575.             lores.add("\247fto spawn at night depending");
  3576.             lores.add("\247fon the moon phase.");
  3577.             if(checkCurrentBiome(player, "SWAMPLAND"))
  3578.                 lores.add("\2472\247lThis is your current biome.");
  3579.             else
  3580.                 lores.add("\247e\247lClick to change to this biome.");
  3581.         } else
  3582.         {
  3583.             meta4.setDisplayName("\2478Biome: Swampland");
  3584.             lores.add("\247cYou cannot use this biome.");
  3585.             lores.add("\2477The swamp biome is dark");
  3586.             lores.add("\2477and dull. Passive mobs");
  3587.             lores.add("\2477will spawn normally and");
  3588.             lores.add("\2477slimes have a small chance");
  3589.             lores.add("\2477to spawn at night depending");
  3590.             lores.add("\2477on the moon phase.");
  3591.         }
  3592.         meta4.setLore(lores);
  3593.         currentBiomeItem.setItemMeta(meta4);
  3594.         GUIbiome.addItem(new ItemStack[] {
  3595.             currentBiomeItem
  3596.         });
  3597.         lores.clear();
  3598.         currentBiomeItem = new ItemStack(Material.SNOW, 1);
  3599.         meta4 = currentBiomeItem.getItemMeta();
  3600.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.taiga", player.getWorld()))
  3601.         {
  3602.             meta4.setDisplayName("\247aBiome: Taiga");
  3603.             lores.add("\247fThe taiga biome has snow");
  3604.             lores.add("\247finstead of rain. Passive");
  3605.             lores.add("\247fmobs will spawn normally");
  3606.             lores.add("\247f(including wolves) and");
  3607.             lores.add("\247fhostile mobs will spawn.");
  3608.             if(checkCurrentBiome(player, "TAIGA"))
  3609.                 lores.add("\2472\247lThis is your current biome.");
  3610.             else
  3611.                 lores.add("\247e\247lClick to change to this biome.");
  3612.         } else
  3613.         {
  3614.             meta4.setDisplayName("\2478Biome: Taiga");
  3615.             lores.add("\247cYou cannot use this biome.");
  3616.             lores.add("\2477The taiga biome has snow");
  3617.             lores.add("\2477instead of rain. Passive");
  3618.             lores.add("\2477mobs will spawn normally");
  3619.             lores.add("\2477(including wolves) and");
  3620.             lores.add("\2477hostile mobs will spawn.");
  3621.         }
  3622.         meta4.setLore(lores);
  3623.         currentBiomeItem.setItemMeta(meta4);
  3624.         GUIbiome.addItem(new ItemStack[] {
  3625.             currentBiomeItem
  3626.         });
  3627.         lores.clear();
  3628.         currentBiomeItem = new ItemStack(Material.RED_MUSHROOM, 1);
  3629.         meta4 = currentBiomeItem.getItemMeta();
  3630.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.mushroom", player.getWorld()))
  3631.         {
  3632.             meta4.setDisplayName("\247aBiome: Mushroom");
  3633.             lores.add("\247fThe mushroom biome is");
  3634.             lores.add("\247fbright and colorful.");
  3635.             lores.add("\247fMooshrooms are the only");
  3636.             lores.add("\247fmobs that will spawn.");
  3637.             lores.add("\247fNo other passive or");
  3638.             lores.add("\247fhostile mobs will spawn.");
  3639.             if(checkCurrentBiome(player, "MUSHROOM"))
  3640.                 lores.add("\2472\247lThis is your current biome.");
  3641.             else
  3642.                 lores.add("\247e\247lClick to change to this biome.");
  3643.         } else
  3644.         {
  3645.             meta4.setDisplayName("\2478Biome: Mushroom");
  3646.             lores.add("\247cYou cannot use this biome.");
  3647.             lores.add("\2477The mushroom biome is");
  3648.             lores.add("\2477bright and colorful.");
  3649.             lores.add("\2477Mooshrooms are the only");
  3650.             lores.add("\2477mobs that will spawn.");
  3651.             lores.add("\2477No other passive or");
  3652.             lores.add("\2477hostile mobs will spawn.");
  3653.         }
  3654.         meta4.setLore(lores);
  3655.         currentBiomeItem.setItemMeta(meta4);
  3656.         GUIbiome.addItem(new ItemStack[] {
  3657.             currentBiomeItem
  3658.         });
  3659.         lores.clear();
  3660.         currentBiomeItem = new ItemStack(Material.FIRE, 1);
  3661.         meta4 = currentBiomeItem.getItemMeta();
  3662.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.hell", player.getWorld()))
  3663.         {
  3664.             meta4.setDisplayName("\247aBiome: Hell(Nether)");
  3665.             lores.add("\247fThe hell biome looks");
  3666.             lores.add("\247fdark and dead. Some");
  3667.             lores.add("\247fmobs from the nether will");
  3668.             lores.add("\247fspawn in this biome");
  3669.             lores.add("\247f(excluding ghasts and");
  3670.             lores.add("\247fblazes).");
  3671.             if(checkCurrentBiome(player, "HELL"))
  3672.                 lores.add("\2472\247lThis is your current biome.");
  3673.             else
  3674.                 lores.add("\247e\247lClick to change to this biome.");
  3675.         } else
  3676.         {
  3677.             meta4.setDisplayName("\2478Biome: Hell(Nether)");
  3678.             lores.add("\247cYou cannot use this biome.");
  3679.             lores.add("\2477The hell biome looks");
  3680.             lores.add("\2477dark and dead. Some");
  3681.             lores.add("\2477mobs from the nether will");
  3682.             lores.add("\2477spawn in this biome");
  3683.             lores.add("\2477(excluding ghasts and");
  3684.             lores.add("\2477blazes).");
  3685.         }
  3686.         meta4.setLore(lores);
  3687.         currentBiomeItem.setItemMeta(meta4);
  3688.         GUIbiome.addItem(new ItemStack[] {
  3689.             currentBiomeItem
  3690.         });
  3691.         lores.clear();
  3692.         currentBiomeItem = new ItemStack(Material.EYE_OF_ENDER, 1);
  3693.         meta4 = currentBiomeItem.getItemMeta();
  3694.         if(VaultHandler.checkPerk(player.getName(), "usb.biome.sky", player.getWorld()))
  3695.         {
  3696.             meta4.setDisplayName("\247aBiome: Sky(End)");
  3697.             lores.add("\247fThe sky biome gives your");
  3698.             lores.add("\247fisland a special dark sky.");
  3699.             lores.add("\247fOnly endermen will spawn");
  3700.             lores.add("\247fin this biome.");
  3701.             if(checkCurrentBiome(player, "SKY"))
  3702.                 lores.add("\2472\247lThis is your current biome.");
  3703.             else
  3704.                 lores.add("\247e\247lClick to change to this biome.");
  3705.         } else
  3706.         {
  3707.             meta4.setDisplayName("\2478Biome: Sky(End)");
  3708.             lores.add("\247cYou cannot use this biome.");
  3709.             lores.add("\2477The sky biome gives your");
  3710.             lores.add("\2477island a special dark sky.");
  3711.             lores.add("\2477Only endermen will spawn");
  3712.             lores.add("\2477in this biome.");
  3713.         }
  3714.         meta4.setLore(lores);
  3715.         currentBiomeItem.setItemMeta(meta4);
  3716.         GUIbiome.addItem(new ItemStack[] {
  3717.             currentBiomeItem
  3718.         });
  3719.         lores.clear();
  3720.         return GUIbiome;
  3721.     }
  3722.  
  3723.     public Inventory displayChallengeGUI(Player player)
  3724.     {
  3725.         GUIchallenge = Bukkit.createInventory(null, 36, "\2479Challenge Menu");
  3726.         PlayerInfo pi = (PlayerInfo)getInstance().getActivePlayers().get(player.getName());
  3727.         populateChallengeRank(player, 0, Material.DIRT, 0, pi);
  3728.         populateChallengeRank(player, 1, Material.IRON_BLOCK, 9, pi);
  3729.         populateChallengeRank(player, 2, Material.GOLD_BLOCK, 18, pi);
  3730.         populateChallengeRank(player, 3, Material.DIAMOND_BLOCK, 27, pi);
  3731.         return GUIchallenge;
  3732.     }
  3733.  
  3734.     public Inventory displayIslandGUI(Player player)
  3735.     {
  3736.         GUIisland = Bukkit.createInventory(null, 18, "\2479Island Menu");
  3737.         if(hasIsland(player.getName()))
  3738.         {
  3739.             currentIslandItem = new ItemStack(Material.ENDER_PORTAL, 1);
  3740.             ItemMeta meta4 = currentIslandItem.getItemMeta();
  3741.             meta4.setDisplayName("\247a\247lReturn Home");
  3742.             lores.add("\247fReturn to your island's home");
  3743.             lores.add("\247fpoint. You can change your home");
  3744.             lores.add("\247fpoint to any location on your");
  3745.             lores.add("\247fisland using \247b/island sethome");
  3746.             lores.add("\247e\247lClick here to return home.");
  3747.             meta4.setLore(lores);
  3748.             currentIslandItem.setItemMeta(meta4);
  3749.             GUIisland.addItem(new ItemStack[] {
  3750.                 currentIslandItem
  3751.             });
  3752.             lores.clear();
  3753.             currentIslandItem = new ItemStack(Material.DIAMOND_ORE, 1);
  3754.             meta4 = currentIslandItem.getItemMeta();
  3755.             meta4.setDisplayName("\247a\247lChallenges");
  3756.             lores.add("\247fView a list of challenges that");
  3757.             lores.add("\247fyou can complete on your island");
  3758.             lores.add("\247fto earn skybucks, items, perks,");
  3759.             lores.add("\247fand titles.");
  3760.             lores.add("\247e\247lClick here to view challenges.");
  3761.             meta4.setLore(lores);
  3762.             currentIslandItem.setItemMeta(meta4);
  3763.             GUIisland.addItem(new ItemStack[] {
  3764.                 currentIslandItem
  3765.             });
  3766.             lores.clear();
  3767.             currentIslandItem = new ItemStack(Material.EXP_BOTTLE, 1);
  3768.             meta4 = currentIslandItem.getItemMeta();
  3769.             meta4.setDisplayName("\247a\247lIsland Level");
  3770.             lores.add((new StringBuilder("\247eCurrent Level: \247a")).append(showIslandLevel(player)).toString());
  3771.             lores.add("\247fGain island levels by expanding");
  3772.             lores.add("\247fyour skyblock and completing");
  3773.             lores.add("\247fcertain challenges. Rarer blocks");
  3774.             lores.add("\247fwill add more to your level.");
  3775.             lores.add("\247e\247lClick here to refresh.");
  3776.             lores.add("\247e\247l(must be on island)");
  3777.             meta4.setLore(lores);
  3778.             currentIslandItem.setItemMeta(meta4);
  3779.             GUIisland.addItem(new ItemStack[] {
  3780.                 currentIslandItem
  3781.             });
  3782.             lores.clear();
  3783.             currentIslandItem = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
  3784.             SkullMeta meta3 = (SkullMeta)currentIslandItem.getItemMeta();
  3785.             meta3.setDisplayName("\247a\247lIsland Group");
  3786.             lores.add((new StringBuilder("\247eMembers: \2472")).append(showCurrentMembers(player)).append("/").append(showMaxMembers(player)).toString());
  3787.             lores.add("\247fView the members of your island");
  3788.             lores.add("\247fgroup and their permissions. If");
  3789.             lores.add("\247fyou are the island leader, you");
  3790.             lores.add("\247fcan change the member permissions.");
  3791.             lores.add("\247e\247lClick here to view or change.");
  3792.             meta3.setLore(lores);
  3793.             currentIslandItem.setItemMeta(meta3);
  3794.             GUIisland.addItem(new ItemStack[] {
  3795.                 currentIslandItem
  3796.             });
  3797.             lores.clear();
  3798.             currentIslandItem = new ItemStack(Material.SAPLING, 1, (short)3);
  3799.             meta4 = currentIslandItem.getItemMeta();
  3800.             meta4.setDisplayName("\247a\247lChange Island Biome");
  3801.             lores.add((new StringBuilder("\247eCurrent Biome: \247b")).append(getCurrentBiome(player).toUpperCase()).toString());
  3802.             lores.add("\247fThe island biome affects things");
  3803.             lores.add("\247flike grass color and spawning");
  3804.             lores.add("\247fof both animals and monsters.");
  3805.             if(checkIslandPermission(player, "canChangeBiome"))
  3806.                 lores.add("\247e\247lClick here to change biomes.");
  3807.             else
  3808.                 lores.add("\247c\247lYou can't change the biome.");
  3809.             meta4.setLore(lores);
  3810.             currentIslandItem.setItemMeta(meta4);
  3811.             GUIisland.addItem(new ItemStack[] {
  3812.                 currentIslandItem
  3813.             });
  3814.             lores.clear();
  3815.             currentIslandItem = new ItemStack(Material.IRON_FENCE, 1);
  3816.             meta4 = currentIslandItem.getItemMeta();
  3817.             meta4.setDisplayName("\247a\247lIsland Lock");
  3818.             if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("general.locked"))
  3819.             {
  3820.                 lores.add("\247eLock Status: \247aActive");
  3821.                 lores.add("\247fYour island is currently \247clocked.");
  3822.                 lores.add("\247fPlayers outside of your group");
  3823.                 lores.add("\247fare unable to enter your island.");
  3824.                 if(checkIslandPermission(player, "canToggleLock"))
  3825.                     lores.add("\247e\247lClick here to unlock your island.");
  3826.                 else
  3827.                     lores.add("\247c\247lYou can't change the lock.");
  3828.             } else
  3829.             {
  3830.                 lores.add("\247eLock Status: \2478Inactive");
  3831.                 lores.add("\247fYour island is currently \247aunlocked.");
  3832.                 lores.add("\247fAll players are able to enter your");
  3833.                 lores.add("\247fisland, but only you and your group");
  3834.                 lores.add("\247fmembers may build there.");
  3835.                 if(checkIslandPermission(player, "canToggleLock"))
  3836.                     lores.add("\247e\247lClick here to lock your island.");
  3837.                 else
  3838.                     lores.add("\247c\247lYou can't change the lock.");
  3839.             }
  3840.             meta4.setLore(lores);
  3841.             currentIslandItem.setItemMeta(meta4);
  3842.             GUIisland.addItem(new ItemStack[] {
  3843.                 currentIslandItem
  3844.             });
  3845.             lores.clear();
  3846.             if(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("general.warpActive"))
  3847.             {
  3848.                 currentIslandItem = new ItemStack(Material.PORTAL, 1);
  3849.                 meta4 = currentIslandItem.getItemMeta();
  3850.                 meta4.setDisplayName("\247a\247lIsland Warp");
  3851.                 lores.add("\247eWarp Status: \247aActive");
  3852.                 lores.add("\247fOther players may warp to your");
  3853.                 lores.add("\247fisland at anytime to the point");
  3854.                 lores.add("\247fyou set using \247d/island setwarp.");
  3855.                 if(checkIslandPermission(player, "canToggleWarp") && VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", getSkyBlockWorld()))
  3856.                     lores.add("\247e\247lClick here to deactivate.");
  3857.                 else
  3858.                     lores.add("\247c\247lYou can't change the warp.");
  3859.             } else
  3860.             {
  3861.                 currentIslandItem = new ItemStack(Material.ENDER_STONE, 1);
  3862.                 meta4 = currentIslandItem.getItemMeta();
  3863.                 meta4.setDisplayName("\247a\247lIsland Warp");
  3864.                 lores.add("\247eWarp Status: \2478Inactive");
  3865.                 lores.add("\247fOther players can't warp to your");
  3866.                 lores.add("\247fisland. Set a warp point using");
  3867.                 lores.add("\247d/island setwarp \247fbefore activating.");
  3868.                 if(checkIslandPermission(player, "canToggleWarp") && VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", getSkyBlockWorld()))
  3869.                     lores.add("\247e\247lClick here to activate.");
  3870.                 else
  3871.                     lores.add("\247c\247lYou can't change the warp.");
  3872.             }
  3873.             meta4.setLore(lores);
  3874.             currentIslandItem.setItemMeta(meta4);
  3875.             GUIisland.addItem(new ItemStack[] {
  3876.                 currentIslandItem
  3877.             });
  3878.             lores.clear();
  3879.             currentIslandItem = new ItemStack(Material.CHEST, 1);
  3880.             meta4 = currentIslandItem.getItemMeta();
  3881.             meta4.setDisplayName("\247a\247lBuy Perks");
  3882.             lores.add("\247fVisit the perk shop to buy");
  3883.             lores.add("\247fspecial abilities for your");
  3884.             lores.add("\247fisland and character, as well");
  3885.             lores.add("\247fas titles and more.");
  3886.             lores.add("\247e\247lClick here to open the shop!");
  3887.             meta4.setLore(lores);
  3888.             currentIslandItem.setItemMeta(meta4);
  3889.             GUIisland.addItem(new ItemStack[] {
  3890.                 currentIslandItem
  3891.             });
  3892.             lores.clear();
  3893.             currentIslandItem = new ItemStack(Material.ENDER_CHEST, 1);
  3894.             meta4 = currentIslandItem.getItemMeta();
  3895.             meta4.setDisplayName("\247a\247lBuy Donor Perks");
  3896.             lores.add("\247fThis special perk shop is");
  3897.             lores.add("\247fonly available to donors!");
  3898.             if(VaultHandler.checkPerk(player.getName(), "group.donor", player.getWorld()))
  3899.                 lores.add("\247e\247lClick here to open the shop!");
  3900.             else
  3901.                 lores.add("\247a\247lClick here to become a donor!");
  3902.             meta4.setLore(lores);
  3903.             currentIslandItem.setItemMeta(meta4);
  3904.             GUIisland.setItem(16, currentIslandItem);
  3905.             lores.clear();
  3906.             currentIslandItem = new ItemStack(Material.BOOK_AND_QUILL, 1);
  3907.             meta4 = currentIslandItem.getItemMeta();
  3908.             meta4.setDisplayName("\247a\247lIsland Log");
  3909.             lores.add("\247fView a log of events from");
  3910.             lores.add("\247fyour island such as member,");
  3911.             lores.add("\247fbiome, and warp changes.");
  3912.             lores.add("\247e\247lClick to view the log.");
  3913.             meta4.setLore(lores);
  3914.             currentIslandItem.setItemMeta(meta4);
  3915.             GUIisland.addItem(new ItemStack[] {
  3916.                 currentIslandItem
  3917.             });
  3918.             lores.clear();
  3919.             currentIslandItem = new ItemStack(Material.BED, 1);
  3920.             meta4 = currentIslandItem.getItemMeta();
  3921.             meta4.setDisplayName("\247a\247lChange Home Location");
  3922.             lores.add("\247fWhen you teleport to your");
  3923.             lores.add("\247fisland you will be taken to");
  3924.             lores.add("\247fthis location.");
  3925.             lores.add("\247e\247lClick here to change.");
  3926.             meta4.setLore(lores);
  3927.             currentIslandItem.setItemMeta(meta4);
  3928.             GUIisland.addItem(new ItemStack[] {
  3929.                 currentIslandItem
  3930.             });
  3931.             lores.clear();
  3932.             currentIslandItem = new ItemStack(Material.HOPPER, 1);
  3933.             meta4 = currentIslandItem.getItemMeta();
  3934.             meta4.setDisplayName("\247a\247lChange Warp Location");
  3935.             lores.add("\247fWhen your warp is activated,");
  3936.             lores.add("\247fother players will be taken to");
  3937.             lores.add("\247fthis point when they teleport");
  3938.             lores.add("\247fto your island.");
  3939.             lores.add("\247e\247lClick here to change.");
  3940.             meta4.setLore(lores);
  3941.             currentIslandItem.setItemMeta(meta4);
  3942.             GUIisland.setItem(15, currentIslandItem);
  3943.             lores.clear();
  3944.         } else
  3945.         if(VaultHandler.checkPerk(player.getName(), "group.member", getSkyBlockWorld()))
  3946.         {
  3947.             currentIslandItem = new ItemStack(Material.GRASS, 1);
  3948.             ItemMeta meta4 = currentIslandItem.getItemMeta();
  3949.             meta4.setDisplayName("\247a\247lStart an Island");
  3950.             lores.add("\247fStart your skyblock journey");
  3951.             lores.add("\247fby starting your own island.");
  3952.             lores.add("\247fComplete challenges to earn");
  3953.             lores.add("\247fitems and skybucks to help");
  3954.             lores.add("\247fexpand your skyblock. You can");
  3955.             lores.add("\247finvite others to join in");
  3956.             lores.add("\247fbuilding your island empire!");
  3957.             lores.add("\247e\247lClick here to start!");
  3958.             meta4.setLore(lores);
  3959.             currentIslandItem.setItemMeta(meta4);
  3960.             GUIisland.addItem(new ItemStack[] {
  3961.                 currentIslandItem
  3962.             });
  3963.             lores.clear();
  3964.             currentIslandItem = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
  3965.             SkullMeta meta3 = (SkullMeta)currentIslandItem.getItemMeta();
  3966.             meta3.setDisplayName("\247a\247lJoin an Island");
  3967.             lores.add("\247fWant to join another player's");
  3968.             lores.add("\247fisland instead of starting");
  3969.             lores.add("\247fyour own? If another player");
  3970.             lores.add("\247finvites you to their island");
  3971.             lores.add("\247fyou can click here or use");
  3972.             lores.add("\247e/island accept \247fto join them.");
  3973.             lores.add("\247e\247lClick here to accept an invite!");
  3974.             lores.add("\247e\247l(You must be invited first)");
  3975.             meta3.setLore(lores);
  3976.             currentIslandItem.setItemMeta(meta3);
  3977.             GUIisland.setItem(4, currentIslandItem);
  3978.             lores.clear();
  3979.             currentIslandItem = new ItemStack(Material.SIGN, 1);
  3980.             meta4 = currentIslandItem.getItemMeta();
  3981.             meta4.setDisplayName("\247a\247lIsland Help");
  3982.             lores.add("\247fNeed help with skyblock");
  3983.             lores.add("\247fconcepts or commands? View");
  3984.             lores.add("\247fdetails about them here.");
  3985.             lores.add("\247e\247lClick here for help!");
  3986.             meta4.setLore(lores);
  3987.             currentIslandItem.setItemMeta(meta4);
  3988.             GUIisland.setItem(8, currentIslandItem);
  3989.             lores.clear();
  3990.         } else
  3991.         {
  3992.             currentIslandItem = new ItemStack(Material.BOOK, 1);
  3993.             ItemMeta meta4 = currentIslandItem.getItemMeta();
  3994.             meta4.setDisplayName("\247a\247lWelcome to the Server!");
  3995.             lores.add("\247fPlease read and accept the");
  3996.             lores.add("\247fserver rules to become a");
  3997.             lores.add("\247fmember and start your skyblock.");
  3998.             lores.add("\247e\247lClick here to read!");
  3999.             meta4.setLore(lores);
  4000.             currentIslandItem.setItemMeta(meta4);
  4001.             GUIisland.addItem(new ItemStack[] {
  4002.                 currentIslandItem
  4003.             });
  4004.             lores.clear();
  4005.         }
  4006.         return GUIisland;
  4007.     }
  4008.  
  4009.     public boolean isPartyLeader(Player player)
  4010.     {
  4011.         return getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getString("party.leader").equalsIgnoreCase(player.getName());
  4012.     }
  4013.  
  4014.     public boolean checkIslandPermission(Player player, String permission)
  4015.     {
  4016.         return getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean((new StringBuilder("party.members.")).append(player.getName()).append(".").append(permission).toString());
  4017.     }
  4018.  
  4019.     public String getCurrentBiome(Player player)
  4020.     {
  4021.         return getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getString("general.biome");
  4022.     }
  4023.  
  4024.     public int showIslandLevel(Player player)
  4025.     {
  4026.         return getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("general.level");
  4027.     }
  4028.  
  4029.     public int showCurrentMembers(Player player)
  4030.     {
  4031.         return getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.currentSize");
  4032.     }
  4033.  
  4034.     public int showMaxMembers(Player player)
  4035.     {
  4036.         return getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize");
  4037.     }
  4038.  
  4039.     public void populateChallengeRank(Player player, int rankIndex, Material mat, int location, PlayerInfo pi)
  4040.     {
  4041.         int rankComplete = 0;
  4042.         currentChallengeItem = new ItemStack(mat, 1);
  4043.         ItemMeta meta4 = currentChallengeItem.getItemMeta();
  4044.         meta4.setDisplayName((new StringBuilder("\247e\247lRank: ")).append(Settings.challenges_ranks[rankIndex]).toString());
  4045.         lores.add("\247fComplete most challenges in");
  4046.         lores.add("\247fthis rank to unlock the next rank.");
  4047.         meta4.setLore(lores);
  4048.         currentChallengeItem.setItemMeta(meta4);
  4049.         GUIchallenge.setItem(location, currentChallengeItem);
  4050.         lores.clear();
  4051.         String challengeList[] = getChallengesFromRank(player, Settings.challenges_ranks[rankIndex]).split(" - ");
  4052.         for(int i = 0; i < challengeList.length; i++)
  4053.         {
  4054.             if(rankIndex > 0)
  4055.             {
  4056.                 rankComplete = getInstance().checkRankCompletion(player, Settings.challenges_ranks[rankIndex - 1]);
  4057.                 if(rankComplete > 0)
  4058.                 {
  4059.                     currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)14);
  4060.                     meta4 = currentChallengeItem.getItemMeta();
  4061.                     meta4.setDisplayName("\2474\247lLocked Challenge");
  4062.                     lores.add((new StringBuilder("\2477Complete ")).append(rankComplete).append(" more ").append(Settings.challenges_ranks[rankIndex - 1]).append(" challenges").toString());
  4063.                     lores.add("\2477to unlock this rank.");
  4064.                     meta4.setLore(lores);
  4065.                     currentChallengeItem.setItemMeta(meta4);
  4066.                     GUIchallenge.setItem(++location, currentChallengeItem);
  4067.                     lores.clear();
  4068.                     continue;
  4069.                 }
  4070.             }
  4071.             if(challengeList[i].charAt(1) == 'e')
  4072.             {
  4073.                 currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)4);
  4074.                 meta4 = currentChallengeItem.getItemMeta();
  4075.                 meta4.setDisplayName(challengeList[i].replace("\247e", "\247e\247l"));
  4076.                 challengeList[i] = challengeList[i].replace("\247e", "");
  4077.                 challengeList[i] = challengeList[i].replace("\2478", "");
  4078.             } else
  4079.             if(challengeList[i].charAt(1) == 'a')
  4080.             {
  4081.                 if(!getInstance().getConfig().contains((new StringBuilder("options.challenges.challengeList.")).append(challengeList[i].replace("\247a", "").replace("\2472", "").replace("\247e", "").replace("\2478", "").toLowerCase()).append(".displayItem").toString()))
  4082.                     currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)5);
  4083.                 else
  4084.                     currentChallengeItem = new ItemStack(Material.getMaterial(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challengeList[i].replace("\247a", "").replace("\2472", "").replace("\247e", "").replace("\2478", "").toLowerCase()).append(".displayItem").toString())), 1);
  4085.                 meta4 = currentChallengeItem.getItemMeta();
  4086.                 meta4.setDisplayName(challengeList[i].replace("\247a", "\247a\247l"));
  4087.                 challengeList[i] = challengeList[i].replace("\247a", "");
  4088.                 challengeList[i] = challengeList[i].replace("\2478", "");
  4089.             } else
  4090.             if(challengeList[i].charAt(1) == '2')
  4091.             {
  4092.                 currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)13);
  4093.                 meta4 = currentChallengeItem.getItemMeta();
  4094.                 meta4.setDisplayName(challengeList[i].replace("\2472", "\2472\247l"));
  4095.                 challengeList[i] = challengeList[i].replace("\2472", "");
  4096.                 challengeList[i] = challengeList[i].replace("\2478", "");
  4097.             } else
  4098.             {
  4099.                 currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)4);
  4100.                 meta4 = currentChallengeItem.getItemMeta();
  4101.                 meta4.setDisplayName(challengeList[i].replace("\247e", "\247e\247l"));
  4102.                 challengeList[i] = challengeList[i].replace("\247e", "");
  4103.                 challengeList[i] = challengeList[i].replace("\2478", "");
  4104.             }
  4105.             lores.add((new StringBuilder("\2477")).append(getInstance().getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challengeList[i].toLowerCase()).append(".description").toString())).toString());
  4106.             lores.add("\247eThis challenge requires the following:");
  4107.             String reqList[] = getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challengeList[i].toLowerCase()).append(".requiredItems").toString()).split(" ");
  4108.             int reqItem = 0;
  4109.             int reqAmount = 0;
  4110.             int reqMod = -1;
  4111.             String as[];
  4112.             int k = (as = reqList).length;
  4113.             for(int j = 0; j < k; j++)
  4114.             {
  4115.                 String s = as[j];
  4116.                 String sPart[] = s.split(":");
  4117.                 if(sPart.length == 2)
  4118.                 {
  4119.                     reqItem = Integer.parseInt(sPart[0]);
  4120.                     String sScale[] = sPart[1].split(";");
  4121.                     if(sScale.length == 1)
  4122.                         reqAmount = Integer.parseInt(sPart[1]);
  4123.                     else
  4124.                     if(sScale.length == 2)
  4125.                         if(sScale[1].charAt(0) == '+')
  4126.                             reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase());
  4127.                         else
  4128.                         if(sScale[1].charAt(0) == '*')
  4129.                             reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase()));
  4130.                         else
  4131.                         if(sScale[1].charAt(0) == '-')
  4132.                             reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase());
  4133.                         else
  4134.                         if(sScale[1].charAt(0) == '/')
  4135.                             reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase()));
  4136.                 } else
  4137.                 if(sPart.length == 3)
  4138.                 {
  4139.                     reqItem = Integer.parseInt(sPart[0]);
  4140.                     String sScale[] = sPart[2].split(";");
  4141.                     if(sScale.length == 1)
  4142.                         reqAmount = Integer.parseInt(sPart[2]);
  4143.                     else
  4144.                     if(sScale.length == 2)
  4145.                         if(sScale[1].charAt(0) == '+')
  4146.                             reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase());
  4147.                         else
  4148.                         if(sScale[1].charAt(0) == '*')
  4149.                             reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase()));
  4150.                         else
  4151.                         if(sScale[1].charAt(0) == '-')
  4152.                             reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase());
  4153.                         else
  4154.                         if(sScale[1].charAt(0) == '/')
  4155.                             reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase()));
  4156.                     reqMod = Integer.parseInt(sPart[1]);
  4157.                 }
  4158.                 ItemStack newItem = new ItemStack(reqItem, reqAmount, (short)reqMod);
  4159.                 lores.add((new StringBuilder("\247f")).append(newItem.getAmount()).append(" ").append(newItem.getType().toString()).toString());
  4160.             }
  4161.  
  4162.             if(pi.checkChallenge(challengeList[i].toLowerCase()) > 0 && getInstance().getConfig().getBoolean((new StringBuilder("options.challenges.challengeList.")).append(challengeList[i].toLowerCase()).append(".repeatable").toString()))
  4163.             {
  4164.                 if(pi.onChallengeCooldown(challengeList[i].toLowerCase()))
  4165.                     if(pi.getChallengeCooldownTime(challengeList[i].toLowerCase()) / 0x5265c00L >= 1L)
  4166.                     {
  4167.                         int days = (int)pi.getChallengeCooldownTime(challengeList[i].toLowerCase()) / 0x5265c00;
  4168.                         lores.add((new StringBuilder("\2474Requirements will reset in ")).append(days).append(" days.").toString());
  4169.                     } else
  4170.                     {
  4171.                         int hours = (int)pi.getChallengeCooldownTime(challengeList[i].toLowerCase()) / 0x36ee80;
  4172.                         lores.add((new StringBuilder("\2474Requirements will reset in ")).append(hours).append(" hours.").toString());
  4173.                     }
  4174.                 lores.add((new StringBuilder("\2476Item Reward: \247a")).append(getInstance().getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challengeList[i].toLowerCase()).append(".repeatRewardText").toString())).toString());
  4175.                 lores.add((new StringBuilder("\2476Currency Reward: \247a")).append(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challengeList[i].toLowerCase()).append(".repeatCurrencyReward").toString())).toString());
  4176.                 lores.add((new StringBuilder("\2476Exp Reward: \247a")).append(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challengeList[i].toLowerCase()).append(".repeatXpReward").toString())).toString());
  4177.                 lores.add((new StringBuilder("\247dTotal times completed: \247f")).append(pi.getChallenge(challengeList[i].toLowerCase()).getTimesCompleted()).toString());
  4178.                 lores.add("\247e\247lClick to complete this challenge.");
  4179.             } else
  4180.             {
  4181.                 lores.add((new StringBuilder("\2476Item Reward: \247a")).append(getInstance().getConfig().getString((new StringBuilder("options.challenges.challengeList.")).append(challengeList[i].toLowerCase()).append(".rewardText").toString())).toString());
  4182.                 lores.add((new StringBuilder("\2476Currency Reward: \247a")).append(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challengeList[i].toLowerCase()).append(".currencyReward").toString())).toString());
  4183.                 lores.add((new StringBuilder("\2476Exp Reward: \247a")).append(getInstance().getConfig().getInt((new StringBuilder("options.challenges.challengeList.")).append(challengeList[i].toLowerCase()).append(".xpReward").toString())).toString());
  4184.                 if(getInstance().getConfig().getBoolean((new StringBuilder("options.challenges.challengeList.")).append(challengeList[i].toLowerCase()).append(".repeatable").toString()))
  4185.                     lores.add("\247e\247lClick to complete this challenge.");
  4186.                 else
  4187.                     lores.add("\2474\247lYou can't repeat this challenge.");
  4188.             }
  4189.             meta4.setLore(lores);
  4190.             currentChallengeItem.setItemMeta(meta4);
  4191.             GUIchallenge.setItem(++location, currentChallengeItem);
  4192.             lores.clear();
  4193.         }
  4194.  
  4195.     }
  4196.  
  4197.     public void sendMessageToIslandGroup(String location, String message)
  4198.     {
  4199.         Iterator temp = getInstance().getIslandConfig(location).getConfigurationSection("party.members").getKeys(false).iterator();
  4200.         date = new Date();
  4201.         String myDateString = DateFormat.getDateInstance(3).format(date).toString();
  4202.         String dateTxt = myDateString;
  4203.         int currentLogPos = getInstance().getIslandConfig(location).getInt("log.logPos");
  4204.         while(temp.hasNext())
  4205.         {
  4206.             String player = (String)temp.next();
  4207.             if(Bukkit.getPlayer(player) != null)
  4208.                 Bukkit.getPlayer(player).sendMessage((new StringBuilder("\247d[skyblock] ")).append(message).toString());
  4209.         }
  4210.         getInstance().getIslandConfig(location).set((new StringBuilder("log.")).append(++currentLogPos).toString(), (new StringBuilder("\247d[")).append(dateTxt).append("] ").append(message).toString());
  4211.         if(currentLogPos < 10)
  4212.             getInstance().getIslandConfig(location).set("log.logPos", Integer.valueOf(currentLogPos));
  4213.         else
  4214.             getInstance().getIslandConfig(location).set("log.logPos", Integer.valueOf(0));
  4215.     }
  4216.  
  4217.     public PluginDescriptionFile pluginFile;
  4218.     public Logger log;
  4219.     Date date;
  4220.     public DecimalFormat df;
  4221.     private FileConfiguration levelConfig;
  4222.     private FileConfiguration lastIslandConfig;
  4223.     private FileConfiguration orphans;
  4224.     private FileConfiguration tempIsland;
  4225.     private FileConfiguration tempPlayer;
  4226.     private HashMap islands;
  4227.     private File levelConfigFile;
  4228.     private File orphanFile;
  4229.     private File lastIslandConfigFile;
  4230.     private File islandConfigFile;
  4231.     private File tempIslandFile;
  4232.     private File tempPlayerFile;
  4233.     public static World skyBlockWorld = null;
  4234.     private static uSkyBlock instance;
  4235.     public List removeList;
  4236.     List rankDisplay;
  4237.     public FileConfiguration configPlugin;
  4238.     public File filePlugin;
  4239.     private Location lastIsland;
  4240.     private Stack orphaned;
  4241.     private Stack tempOrphaned;
  4242.     private Stack reverseOrphaned;
  4243.     public File directoryPlayers;
  4244.     public File directoryIslands;
  4245.     private File directorySchematics;
  4246.     public File schemFile[];
  4247.     public String pName;
  4248.     public Location islandTestLocation;
  4249.     LinkedHashMap topTen;
  4250.     HashMap infoCooldown;
  4251.     HashMap restartCooldown;
  4252.     HashMap biomeCooldown;
  4253.     HashMap activePlayers;
  4254.     LinkedHashMap challenges;
  4255.     HashMap requiredList;
  4256.     public boolean purgeActive;
  4257.     private FileConfiguration skyblockData;
  4258.     private File skyblockDataFile;
  4259.     public Inventory GUIparty;
  4260.     public Inventory GUIpartyPlayer;
  4261.     public Inventory GUIisland;
  4262.     public Inventory GUIchallenge;
  4263.     public Inventory GUIbiome;
  4264.     public Inventory GUIlog;
  4265.     ItemStack pHead;
  4266.     ItemStack sign;
  4267.     ItemStack biome;
  4268.     ItemStack lock;
  4269.     ItemStack warpset;
  4270.     ItemStack warptoggle;
  4271.     ItemStack invite;
  4272.     ItemStack kick;
  4273.     ItemStack currentBiomeItem;
  4274.     ItemStack currentIslandItem;
  4275.     ItemStack currentChallengeItem;
  4276.     ItemStack currentLogItem;
  4277.     List lores;
  4278.     Iterator tempIt;
  4279.     private ArrayList sfiles;
  4280.  
  4281.  
  4282.  
  4283. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement