SHARE
TWEET

Untitled

a guest Sep 15th, 2019 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.fenix.menus.Menus;
  2.  
  3.  
  4. import org.bukkit.command.*;
  5. import org.bukkit.entity.*;
  6. import org.bukkit.event.inventory.*;
  7. import org.bukkit.*;
  8. import org.bukkit.event.*;
  9. import org.bukkit.inventory.*;
  10. import java.util.*;
  11. import org.bukkit.inventory.meta.*;
  12.  
  13. public class MainMenu implements Listener, CommandExecutor
  14. {
  15.     public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
  16.         final Player p = (Player)sender;
  17.         if (cmd.getName().equalsIgnoreCase("menu")) {
  18.             this.openGUI(p);
  19.         }
  20.         return false;
  21.     }
  22.    
  23.     @EventHandler
  24.     public void InventoryClickEvent(final InventoryClickEvent e) {
  25.         final Player p = (Player)e.getWhoClicked();
  26.         if (e.getCurrentItem().getType() == Material.STAINED_GLASS_PANE && e.getCurrentItem().getItemMeta().hasDisplayName()) {
  27.             e.setCancelled(true);
  28.         }
  29.         if (e.getCurrentItem().getType() == Material.SKULL_ITEM && e.getCurrentItem().getItemMeta().hasDisplayName()) {
  30.             e.setCancelled(true);
  31.         }
  32.         if (e.getCurrentItem().getType() == Material.WOOD_AXE && e.getCurrentItem().getItemMeta().hasDisplayName())
  33.         {   Bukkit.dispatchCommand((CommandSender)p, "warp gungame");
  34.             e.setCancelled(true);
  35.         }
  36.         if (e.getCurrentItem().getType() == Material.STAINED_CLAY && e.getCurrentItem().getItemMeta().hasDisplayName()) {
  37.             Bukkit.dispatchCommand((CommandSender)p, "warp thebridge");
  38.             e.setCancelled(true);
  39.         }
  40.         if (e.getCurrentItem().getType() == Material.DIAMOND_PICKAXE && e.getCurrentItem().getItemMeta().hasDisplayName()) {
  41.             Bukkit.dispatchCommand((CommandSender)p, "warp prison");
  42.             e.setCancelled(true);
  43.         }
  44.         if (e.getCurrentItem().getType() == Material.COAL_BLOCK && e.getCurrentItem().getItemMeta().hasDisplayName()) {
  45.             Bukkit.dispatchCommand((CommandSender)p, "warp annirun");
  46.             e.setCancelled(true);
  47.         }
  48.         if (e.getCurrentItem().getType() == Material.BARRIER && e.getCurrentItem().getItemMeta().hasDisplayName()) {
  49.             p.closeInventory();
  50.             e.setCancelled(true);
  51.         }
  52.     }
  53.    
  54.     public void openGUI(final Player p) {
  55.         final Inventory gui = Bukkit.createInventory((InventoryHolder)null, 54, "GameMenu");
  56.         gui.setItem(4, this.Inventory_Profile_Item(p));
  57.         gui.setItem(0, this.Glass1(p));
  58.         gui.setItem(32, this.PRISON(p));
  59.         gui.setItem(23, this.GUNGAME(p));
  60.         gui.setItem(30, this.THEBRIDGE(p));
  61.         gui.setItem(21, this.ANNIRUN(p));
  62.         gui.setItem(9, this.Glass1(p));
  63.         gui.setItem(17, this.Glass1(p));
  64.         gui.setItem(1, this.Glass1(p));
  65.         gui.setItem(44, this.Glass1(p));
  66.         gui.setItem(2, this.Glass1(p));
  67.         gui.setItem(3, this.Glass1(p));
  68.         gui.setItem(5, this.Glass1(p));
  69.         gui.setItem(6, this.Glass1(p));
  70.         gui.setItem(7, this.Glass1(p));
  71.         gui.setItem(8, this.Glass1(p));
  72.         gui.setItem(18, this.Glass1(p));
  73.         gui.setItem(26, this.Glass1(p));
  74.         gui.setItem(35, this.Glass1(p));
  75.         gui.setItem(36, this.Glass1(p));
  76.         gui.setItem(27, this.Glass1(p));
  77.         gui.setItem(53, this.Glass1(p));
  78.         gui.setItem(45, this.Glass1(p));
  79.         gui.setItem(50, this.Glass1(p));
  80.         gui.setItem(51, this.Glass1(p));
  81.         gui.setItem(52, this.Glass1(p));
  82.         gui.setItem(48, this.Glass1(p));
  83.         gui.setItem(47, this.Glass1(p));
  84.         gui.setItem(46, this.Glass1(p));
  85.         gui.setItem(49, this.Back(p));
  86.         p.openInventory(gui);
  87.     }
  88.    
  89.     public ItemStack Inventory_Profile_Item(final Player p) {
  90.         final ItemStack is = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
  91.         final SkullMeta meta = (SkullMeta)is.getItemMeta();
  92.         meta.setOwner(p.getName()); {
  93.          meta.setDisplayName("§7" + p.getName());
  94.         }
  95.         final ArrayList<String> lore = new ArrayList<String>();
  96.         meta.setLore((List)lore);
  97.         is.setItemMeta((ItemMeta)meta);
  98.         return is;
  99.     }
  100.    
  101.     public ItemStack Back(final Player p) {
  102.         final ItemStack is = new ItemStack(Material.BARRIER, 1, (short)3);
  103.         final ItemMeta meta = is.getItemMeta();
  104.         meta.setDisplayName("§4Back");
  105.         final ArrayList<String> lore = new ArrayList<String>();
  106.         meta.setLore((List)lore);
  107.         is.setItemMeta(meta);
  108.         return is;
  109.     }
  110.    
  111.     public ItemStack THEBRIDGE(final Player p) {
  112.         final ItemStack is = new ItemStack(Material.STAINED_CLAY, 1, DyeColor.WHITE.getWoolData());
  113.         final ItemMeta meta = is.getItemMeta();
  114.         meta.setDisplayName("§aTheBridge");
  115.         final ArrayList<String> lore = new ArrayList<String>();
  116.         meta.setLore((List)lore);
  117.         is.setItemMeta(meta);
  118.         return is;
  119.         }
  120.    
  121.     @SuppressWarnings("unchecked")
  122.     public ItemStack PRISON(final Player p) {
  123.         final ItemStack is = new ItemStack(Material.DIAMOND_PICKAXE);
  124.         final ItemMeta meta = is.getItemMeta();
  125.         meta.setDisplayName("§aPrison");
  126.         final ArrayList<String> lore = new ArrayList<String>();
  127.         meta.setLore((List)lore);
  128.         is.setItemMeta(meta);
  129.         return is;
  130.     }
  131.    
  132.     public ItemStack GUNGAME(final Player p) {
  133.         final ItemStack is = new ItemStack(Material.WOOD_AXE);
  134.         final ItemMeta meta = is.getItemMeta();
  135.         meta.setDisplayName("§aGunGame");
  136.         final ArrayList<String> lore = new ArrayList<String>();
  137.         meta.setLore((List)lore);
  138.         is.setItemMeta(meta);
  139.         return is;
  140.     }
  141.    
  142.     @SuppressWarnings({ "unchecked", "rawtypes" })
  143.     public ItemStack ANNIRUN(final Player p) {
  144.         final ItemStack is = new ItemStack(Material.COAL_BLOCK);
  145.         final ItemMeta meta = is.getItemMeta();
  146.         meta.setDisplayName("§aAnniRun");
  147.         final ArrayList<String> lore = new ArrayList<String>();
  148.         meta.setLore((List)lore);
  149.         is.setItemMeta(meta);
  150.         return is;
  151.     }
  152.    
  153.     @SuppressWarnings("unchecked")
  154.     public ItemStack Glass1(final Player p) {
  155.         final ItemStack is = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)5);
  156.         final ItemMeta meta = is.getItemMeta();
  157.         meta.setDisplayName("§f");
  158.         final ArrayList<String> lore = new ArrayList<String>();
  159.         meta.setLore((List)lore);
  160.         is.setItemMeta(meta);
  161.         return is;
  162.     }
  163. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top