Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.fenix.menus.Menus;
- import org.bukkit.command.*;
- import org.bukkit.entity.*;
- import org.bukkit.event.inventory.*;
- import org.bukkit.*;
- import org.bukkit.event.*;
- import org.bukkit.inventory.*;
- import java.util.*;
- import org.bukkit.inventory.meta.*;
- public class MainMenu implements Listener, CommandExecutor
- {
- public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
- final Player p = (Player)sender;
- if (cmd.getName().equalsIgnoreCase("menu")) {
- this.openGUI(p);
- }
- return false;
- }
- @EventHandler
- public void InventoryClickEvent(final InventoryClickEvent e) {
- final Player p = (Player)e.getWhoClicked();
- if (e.getCurrentItem().getType() == Material.STAINED_GLASS_PANE && e.getCurrentItem().getItemMeta().hasDisplayName()) {
- e.setCancelled(true);
- }
- if (e.getCurrentItem().getType() == Material.SKULL_ITEM && e.getCurrentItem().getItemMeta().hasDisplayName()) {
- e.setCancelled(true);
- }
- if (e.getCurrentItem().getType() == Material.WOOD_AXE && e.getCurrentItem().getItemMeta().hasDisplayName())
- { Bukkit.dispatchCommand((CommandSender)p, "warp gungame");
- e.setCancelled(true);
- }
- if (e.getCurrentItem().getType() == Material.STAINED_CLAY && e.getCurrentItem().getItemMeta().hasDisplayName()) {
- Bukkit.dispatchCommand((CommandSender)p, "warp thebridge");
- e.setCancelled(true);
- }
- if (e.getCurrentItem().getType() == Material.DIAMOND_PICKAXE && e.getCurrentItem().getItemMeta().hasDisplayName()) {
- Bukkit.dispatchCommand((CommandSender)p, "warp prison");
- e.setCancelled(true);
- }
- if (e.getCurrentItem().getType() == Material.COAL_BLOCK && e.getCurrentItem().getItemMeta().hasDisplayName()) {
- Bukkit.dispatchCommand((CommandSender)p, "warp annirun");
- e.setCancelled(true);
- }
- if (e.getCurrentItem().getType() == Material.BARRIER && e.getCurrentItem().getItemMeta().hasDisplayName()) {
- p.closeInventory();
- e.setCancelled(true);
- }
- }
- public void openGUI(final Player p) {
- final Inventory gui = Bukkit.createInventory((InventoryHolder)null, 54, "GameMenu");
- gui.setItem(4, this.Inventory_Profile_Item(p));
- gui.setItem(0, this.Glass1(p));
- gui.setItem(32, this.PRISON(p));
- gui.setItem(23, this.GUNGAME(p));
- gui.setItem(30, this.THEBRIDGE(p));
- gui.setItem(21, this.ANNIRUN(p));
- gui.setItem(9, this.Glass1(p));
- gui.setItem(17, this.Glass1(p));
- gui.setItem(1, this.Glass1(p));
- gui.setItem(44, this.Glass1(p));
- gui.setItem(2, this.Glass1(p));
- gui.setItem(3, this.Glass1(p));
- gui.setItem(5, this.Glass1(p));
- gui.setItem(6, this.Glass1(p));
- gui.setItem(7, this.Glass1(p));
- gui.setItem(8, this.Glass1(p));
- gui.setItem(18, this.Glass1(p));
- gui.setItem(26, this.Glass1(p));
- gui.setItem(35, this.Glass1(p));
- gui.setItem(36, this.Glass1(p));
- gui.setItem(27, this.Glass1(p));
- gui.setItem(53, this.Glass1(p));
- gui.setItem(45, this.Glass1(p));
- gui.setItem(50, this.Glass1(p));
- gui.setItem(51, this.Glass1(p));
- gui.setItem(52, this.Glass1(p));
- gui.setItem(48, this.Glass1(p));
- gui.setItem(47, this.Glass1(p));
- gui.setItem(46, this.Glass1(p));
- gui.setItem(49, this.Back(p));
- p.openInventory(gui);
- }
- public ItemStack Inventory_Profile_Item(final Player p) {
- final ItemStack is = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
- final SkullMeta meta = (SkullMeta)is.getItemMeta();
- meta.setOwner(p.getName()); {
- meta.setDisplayName("§7" + p.getName());
- }
- final ArrayList<String> lore = new ArrayList<String>();
- meta.setLore((List)lore);
- is.setItemMeta((ItemMeta)meta);
- return is;
- }
- public ItemStack Back(final Player p) {
- final ItemStack is = new ItemStack(Material.BARRIER, 1, (short)3);
- final ItemMeta meta = is.getItemMeta();
- meta.setDisplayName("§4Back");
- final ArrayList<String> lore = new ArrayList<String>();
- meta.setLore((List)lore);
- is.setItemMeta(meta);
- return is;
- }
- public ItemStack THEBRIDGE(final Player p) {
- final ItemStack is = new ItemStack(Material.STAINED_CLAY, 1, DyeColor.WHITE.getWoolData());
- final ItemMeta meta = is.getItemMeta();
- meta.setDisplayName("§aTheBridge");
- final ArrayList<String> lore = new ArrayList<String>();
- meta.setLore((List)lore);
- is.setItemMeta(meta);
- return is;
- }
- @SuppressWarnings("unchecked")
- public ItemStack PRISON(final Player p) {
- final ItemStack is = new ItemStack(Material.DIAMOND_PICKAXE);
- final ItemMeta meta = is.getItemMeta();
- meta.setDisplayName("§aPrison");
- final ArrayList<String> lore = new ArrayList<String>();
- meta.setLore((List)lore);
- is.setItemMeta(meta);
- return is;
- }
- public ItemStack GUNGAME(final Player p) {
- final ItemStack is = new ItemStack(Material.WOOD_AXE);
- final ItemMeta meta = is.getItemMeta();
- meta.setDisplayName("§aGunGame");
- final ArrayList<String> lore = new ArrayList<String>();
- meta.setLore((List)lore);
- is.setItemMeta(meta);
- return is;
- }
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public ItemStack ANNIRUN(final Player p) {
- final ItemStack is = new ItemStack(Material.COAL_BLOCK);
- final ItemMeta meta = is.getItemMeta();
- meta.setDisplayName("§aAnniRun");
- final ArrayList<String> lore = new ArrayList<String>();
- meta.setLore((List)lore);
- is.setItemMeta(meta);
- return is;
- }
- @SuppressWarnings("unchecked")
- public ItemStack Glass1(final Player p) {
- final ItemStack is = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)5);
- final ItemMeta meta = is.getItemMeta();
- meta.setDisplayName("§f");
- final ArrayList<String> lore = new ArrayList<String>();
- meta.setLore((List)lore);
- is.setItemMeta(meta);
- return is;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement