Advertisement
chumanista

Untitled

Jul 16th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.33 KB | None | 0 0
  1. package item;
  2.  
  3. import java.util.Arrays;
  4. import java.util.Set;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.ChatColor;
  8. import org.bukkit.Material;
  9. import org.bukkit.inventory.Inventory;
  10. import org.bukkit.inventory.ItemStack;
  11. import org.bukkit.inventory.meta.ItemMeta;
  12.  
  13. import com.chumanista.youtube.Utils;
  14. import com.chumanista.youtube.pt;
  15.  
  16. public class TeleportGUI {
  17.    
  18.     public static Inventory inv;
  19.     static {
  20.        
  21.         int parkours = pt.getPlugin().getConfig().getConfigurationSection("PARKOURS").getKeys(false).size();
  22.         int slots = 9;
  23.        
  24.         while (slots > parkours) {
  25.             slots += 9;
  26.         }
  27.         inv = Bukkit.createInventory(null, slots, ChatColor.GREEN + "" + ChatColor.BOLD + "PARKOURY");
  28.        
  29.         Set<String> keys;
  30.         ItemStack is;
  31.         int metadata = 8;
  32.         keys = pt.getPlugin().getConfig().getConfigurationSection("PARKOURS").getKeys(false);
  33.  
  34.         for (String s : keys) {
  35.            
  36.             String dif = pt.getPlugin().getConfig().getString("PARKOURS." + s + ".difficulty");
  37.             if (dif.equals("easy")) {metadata = 10;}
  38.             else if (dif.equals("medium")) {metadata = 14;}
  39.             else if (dif.equals("hard")) {metadata = 1;}
  40.             else {Utils.Error("Wrong difficulty! Correct flags: easy, medium, hard");}
  41.            
  42.             is = new ItemStack(Material.INK_SACK, 1, (short) metadata);
  43.            
  44.             String st = ChatColor.translateAlternateColorCodes('&', s);
  45.             ItemMeta im = is.getItemMeta();
  46.             im.setDisplayName(st);
  47.            
  48.             if (pt.getPlugin().getConfig().getString("PARKOURS." + s + ".time") == "short") {
  49.                 im.setLore(Arrays.asList(ChatColor.AQUA + "Czas: " + ChatColor.GREEN + "KROTKI", ChatColor.AQUA + "XP: " + pt.getPlugin().getConfig().getInt("PARKOURS." + s + ".xp")));
  50.             }
  51.            
  52.             else if (pt.getPlugin().getConfig().getString("PARKOURS." + s + ".time") == "medium") {
  53.                 im.setLore(Arrays.asList(ChatColor.AQUA + "Czas: " + ChatColor.GOLD + "SREDNI", ChatColor.AQUA + "XP: " + pt.getPlugin().getConfig().getInt("PARKOURS." + s + ".xp")));
  54.             }
  55.            
  56.             else if (pt.getPlugin().getConfig().getString("PARKOURS." + s + ".time") == "long") {
  57.                 im.setLore(Arrays.asList(ChatColor.AQUA + "Czas: " + ChatColor.RED + "DLUGI", ChatColor.AQUA + "XP: " + pt.getPlugin().getConfig().getInt("PARKOURS." + s + ".xp")));
  58.             }          
  59.            
  60.             else {
  61.                 Utils.Error("Wrong time! Correct flags: short, medium, long!");
  62.             }
  63.            
  64.             is.setItemMeta(im);
  65.             inv.addItem(is);
  66.         }
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement