Advertisement
Guest User

Menu.java

a guest
Jul 2nd, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.54 KB | None | 0 0
  1. package me.hrsn0410.rp;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.ChatColor;
  8. import org.bukkit.DyeColor;
  9. import org.bukkit.Material;
  10. import org.bukkit.entity.Player;
  11. import org.bukkit.inventory.Inventory;
  12. import org.bukkit.inventory.ItemStack;
  13. import org.bukkit.inventory.meta.ItemMeta;
  14.  
  15. public class Menu {
  16.    
  17.     @SuppressWarnings("deprecation")
  18.     public static Inventory getResourcePackMenu(Player player) {
  19.        
  20.         Inventory i = Bukkit.createInventory(null, 9, colorize("&1Resource Packs"));
  21.        
  22.         ItemStack noPack = new ItemStack(Material.REDSTONE_BLOCK, 1);
  23.        
  24.         ItemMeta itm = noPack.getItemMeta();
  25.        
  26.         itm.setDisplayName(colorize("&4&lNo Pack"));
  27.        
  28.         itm.setLore(getNoPackLore());
  29.        
  30.         noPack.setItemMeta(itm);
  31.        
  32.         i.setItem(0, noPack);
  33.        
  34.         ItemStack blackglass = new ItemStack(Material.STAINED_GLASS_PANE, 1, DyeColor.BLACK.getData());
  35.        
  36.         ItemMeta im = blackglass.getItemMeta();
  37.        
  38.         im.setDisplayName(colorize("&a&lx16 Resolution"));
  39.        
  40.         im.setLore(getResolutionDescriptionLore("x86 or x64", "1-2 GB", "Medium"));
  41.        
  42.         blackglass.setItemMeta(im);
  43.        
  44.         i.setItem(3, blackglass);
  45.        
  46.         im.setDisplayName(colorize("&a&lx32 Resolution"));
  47.        
  48.         im.setLore(getResolutionDescriptionLore("x86 or x64", "1-2 GB", "Medium"));
  49.        
  50.         blackglass.setItemMeta(im);
  51.        
  52.         i.setItem(4, blackglass);
  53.        
  54.         im.setDisplayName(colorize("&a&lx64 Resolution"));
  55.        
  56.         im.setLore(getResolutionDescriptionLore("x86 or x64", "1-2 GB", "Medium"));
  57.        
  58.         blackglass.setItemMeta(im);
  59.        
  60.         i.setItem(5, blackglass);
  61.        
  62.         im.setDisplayName(colorize("&a&lx128 Resolution"));
  63.        
  64.         im.setLore(getResolutionDescriptionLore("x86 or x64", "2-8 GB", "Good"));
  65.        
  66.         blackglass.setItemMeta(im);
  67.        
  68.         i.setItem(6, blackglass);
  69.        
  70.         im.setDisplayName(colorize("&a&lx256 Resolution"));
  71.        
  72.         im.setLore(getResolutionDescriptionLore("x64", "8-16 GB", "Great"));
  73.        
  74.         blackglass.setItemMeta(im);
  75.        
  76.         i.setItem(7, blackglass);
  77.        
  78.         im.setDisplayName(colorize("&a&lx512 Resolution"));
  79.        
  80.         im.setLore(getResolutionDescriptionLore("x64", "8-16 GB", "Amazing"));
  81.        
  82.         blackglass.setItemMeta(im);
  83.        
  84.         i.setItem(8, blackglass);
  85.        
  86.         // end resoulution descriptions
  87.        
  88.         im.setDisplayName(colorize("&a&lSphax Resource Pack"));
  89.        
  90.         im.setLore(getResourcePackLore(Pack.SPHAX));
  91.        
  92.         blackglass.setItemMeta(im);
  93.        
  94.         i.setItem(18, blackglass);
  95.        
  96.         i.setItem(21, itemStackForResourcePack(player, "x16", Pack.SPHAX));
  97.         i.setItem(22, itemStackForResourcePack(player, "x32", Pack.SPHAX));
  98.         i.setItem(23, itemStackForResourcePack(player, "x64", Pack.SPHAX));
  99.         i.setItem(24, itemStackForResourcePack(player, "x128", Pack.SPHAX));
  100.         i.setItem(25, itemStackForResourcePack(player, "x256", Pack.SPHAX));
  101.         i.setItem(26, itemStackForResourcePack(player, "x512", Pack.SPHAX));
  102.        
  103.         im.setDisplayName(colorize("&a&lFaithful Resource Pack"));
  104.        
  105.         im.setLore(getResourcePackLore(Pack.FAITHFUL));
  106.        
  107.         blackglass.setItemMeta(im);
  108.        
  109.         i.setItem(27, blackglass);
  110.        
  111.         i.setItem(30, getNotAvailibleItemStack(Pack.FAITHFUL, "x16"));
  112.         i.setItem(31, itemStackForResourcePack(player, "x32", Pack.FAITHFUL));
  113.         i.setItem(32, getNotAvailibleItemStack(Pack.FAITHFUL, "x64"));
  114.         i.setItem(33, getNotAvailibleItemStack(Pack.FAITHFUL, "x128"));
  115.         i.setItem(34, getNotAvailibleItemStack(Pack.FAITHFUL, "x256"));
  116.         i.setItem(35, getNotAvailibleItemStack(Pack.FAITHFUL, "x512"));
  117.        
  118.         im.setDisplayName(colorize("&a&lFlow Resource Pack"));
  119.        
  120.         im.setLore(getResourcePackLore(Pack.FLOW));
  121.        
  122.         blackglass.setItemMeta(im);
  123.        
  124.         i.setItem(36, blackglass);
  125.        
  126.         i.setItem(39, getNotAvailibleItemStack(Pack.FLOW, "x16"));
  127.         i.setItem(40, getNotAvailibleItemStack(Pack.FLOW, "x32"));
  128.         i.setItem(41, itemStackForResourcePack(player, "x64", Pack.FLOW));
  129.         i.setItem(42, getNotAvailibleItemStack(Pack.FLOW, "x128"));
  130.         i.setItem(43, getNotAvailibleItemStack(Pack.FLOW, "x256"));
  131.         i.setItem(44, getNotAvailibleItemStack(Pack.FLOW, "x512"));
  132.        
  133.         im.setDisplayName(colorize("&a&lLego Resource Pack"));
  134.        
  135.         im.setLore(getResourcePackLore(Pack.LEGO));
  136.        
  137.         blackglass.setItemMeta(im);
  138.        
  139.         i.setItem(45, blackglass);
  140.        
  141.         i.setItem(50, itemStackForResourcePack(player, "x16", Pack.LEGO));
  142.         i.setItem(48, getNotAvailibleItemStack(Pack.LEGO, "x32"));
  143.         i.setItem(49, getNotAvailibleItemStack(Pack.LEGO, "x64"));
  144.         i.setItem(51, getNotAvailibleItemStack(Pack.LEGO, "x128"));
  145.         i.setItem(52, getNotAvailibleItemStack(Pack.LEGO, "x256"));
  146.         i.setItem(53, getNotAvailibleItemStack(Pack.LEGO, "x512"));
  147.        
  148.         return i;
  149.        
  150.     }
  151.    
  152.     public static List<String> getResolutionDescriptionLore(String cpu, String ram, String graphics) {
  153.        
  154.         List<String> lore = new ArrayList<String>();
  155.        
  156.         lore.add(colorize("&f"));
  157.         lore.add(colorize("&d&lCPU&r&f " + cpu));
  158.         lore.add(colorize("&d&lRam&r&f " + ram));
  159.         lore.add(colorize("&d&lGraphics&r&f " + graphics));
  160.        
  161.         return lore;
  162.        
  163.     }
  164.    
  165.     public static List<String> getNotAvailibleLore(String resolution, String packname) {
  166.        
  167.         List<String> lore = new ArrayList<String>();
  168.        
  169.         lore.add(colorize("&f"));
  170.         lore.add(colorize("&c&lThe " + packname + " pack does not offer"));
  171.         lore.add(colorize("&c&ltheir pack in the " + resolution + " resolution."));
  172.        
  173.         return lore;
  174.        
  175.     }
  176.    
  177.     public static List<String> getNoPackLore() {
  178.        
  179.         List<String> lore = new ArrayList<String>();
  180.        
  181.         lore.add(colorize("&f"));
  182.         lore.add(colorize("&c&lBack to the Vanilla"));
  183.         lore.add(colorize("&c&lMinecraft resource pack."));
  184.        
  185.         return lore;
  186.        
  187.     }
  188.    
  189.     public static List<String> getResourcePackLore(Pack resourcepack) {
  190.        
  191.         List<String> lore = new ArrayList<String>();
  192.        
  193.         switch(resourcepack) {
  194.        
  195.         case SPHAX:
  196.            
  197.             lore.add(colorize("&f"));
  198.             lore.add(colorize("&fMade to make you feel like"));
  199.             lore.add(colorize("&fyou're in a Comic book!"));
  200.            
  201.         case FAITHFUL:
  202.            
  203.             lore.add(colorize("&f"));
  204.             lore.add(colorize("&fHigher resolution textures while"));
  205.             lore.add(colorize("&fstaying faithful to the Vanilla feel."));
  206.  
  207.         case FLOW:
  208.            
  209.             lore.add(colorize("&f"));
  210.             lore.add(colorize("&fHigher resolution textures while"));
  211.             lore.add(colorize("&fstaying faithful to the Vanilla feel."));
  212.            
  213.         case LEGO:
  214.            
  215.             lore.add(colorize("&f"));
  216.             lore.add(colorize("&fMakes Minecraft look like everyone's"));
  217.             lore.add(colorize("&ffavorite Building Blocks."));
  218.  
  219.         default:
  220.            
  221.             lore.add(colorize("&f"));
  222.             lore.add(colorize("&c&lBUG: NOT FOUND."));
  223.             lore.add(colorize("&cAlert the developers."));
  224.            
  225.        
  226.         }
  227.        
  228.         return lore;
  229.  
  230.     }
  231.    
  232.     public static List<String> getClickToEnableLore() {
  233.        
  234.         List<String> lore = new ArrayList<String>();
  235.        
  236.         lore.add(colorize("&f"));
  237.         lore.add(colorize("&a&lClick to Enable."));
  238.        
  239.         return lore;
  240.        
  241.     }
  242.    
  243.     public static List<String> getAlreadyEnabledLore() {
  244.        
  245.         List<String> lore = new ArrayList<String>();
  246.        
  247.         lore.add(colorize("&f"));
  248.         lore.add(colorize("&aYou have this pack enabled."));
  249.        
  250.         return lore;
  251.        
  252.     }
  253.    
  254.     @SuppressWarnings("deprecation")
  255.     public static ItemStack itemStackForResourcePack(Player player, String resolution, Pack pack) {
  256.        
  257.         ItemStack is = new ItemStack(Material.IRON_BLOCK, 1);
  258.        
  259.         if (Pack.getResourcePack(player) == pack && resolution == Pack.getResolution(player)) {
  260.            
  261.             is.setType(Material.STAINED_GLASS_PANE);
  262.             is.setDurability(DyeColor.LIME.getData());
  263.            
  264.             ItemMeta gim = is.getItemMeta();
  265.            
  266.             gim.setDisplayName(colorize("&a&l" + Pack.getPackName(pack) + Pack.getResolution(player)));
  267.            
  268.             gim.setLore(getAlreadyEnabledLore());
  269.            
  270.             is.setItemMeta(gim);
  271.            
  272.             return is;
  273.            
  274.         }
  275.        
  276.         else {
  277.            
  278.             is.setType(Material.STAINED_GLASS_PANE);
  279.             is.setDurability(DyeColor.WHITE.getData());
  280.            
  281.             ItemMeta wim = is.getItemMeta();
  282.            
  283.             wim.setDisplayName(colorize("&a&l" + Pack.getPackName(pack) + Pack.getResolution(player)));
  284.            
  285.             wim.setLore(getAlreadyEnabledLore());
  286.            
  287.             is.setItemMeta(wim);
  288.            
  289.             return is;
  290.            
  291.         }
  292.        
  293.     }
  294.    
  295.     @SuppressWarnings("deprecation")
  296.     public static ItemStack getNotAvailibleItemStack(Pack pack, String resolution) {
  297.        
  298.         ItemStack is = new ItemStack(Material.IRON_BLOCK, 1);
  299.        
  300.         is.setType(Material.STAINED_GLASS_PANE);
  301.         is.setDurability(DyeColor.RED.getData());
  302.        
  303.         ItemMeta wim = is.getItemMeta();
  304.        
  305.         wim.setDisplayName(colorize("&c&lNot Availible."));
  306.        
  307.         wim.setLore(getNotAvailibleLore(Pack.getPackName(pack), resolution));
  308.        
  309.         is.setItemMeta(wim);
  310.        
  311.         return is;
  312.        
  313.     }
  314.    
  315.     public static String colorize(String string) { return ChatColor.translateAlternateColorCodes('&', string); }
  316.  
  317. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement