SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void InventoryClickEvent(InventoryClickEvent e) {
  2.         Player player = (Player) e.getWhoClicked();
  3.         ItemStack clicked = e.getCurrentItem();
  4.         Inventory inventory = e.getInventory();
  5.         ItemStack no = new ItemStack( Material.WOOL, 1, (byte)14);
  6.         ItemStack yes = new ItemStack( Material.WOOL, 1, (byte)5);
  7.  
  8.  
  9.         if (inventory.getName().equals("§cTribal Vote GUI")) {
  10.             if (clicked.getType() == Material.SKULL_ITEM) {
  11.                 ItemStack sto = e.getCurrentItem();
  12.                 e.setCancelled(true);
  13.                   Inventory inv = Bukkit.createInventory(null, 9, "§cConfirm Vote");
  14.                   ItemMeta nomet = no.getItemMeta();
  15.                   nomet.setDisplayName(ChatColor.RED + "Cancel Vote");
  16.                   ItemMeta itemMeta = yes.getItemMeta();
  17.                   itemMeta.setDisplayName(ChatColor.DARK_GREEN + "Confirm Vote");
  18.  
  19.                   inv.setItem(2, no);
  20.                   inv.setItem(6, yes);
  21.                   inv.setItem(4, sto);
  22.                   player.openInventory(inv);
  23.                   return;
  24.  
  25.             }
  26.             return;
  27.         }
  28.         if (inventory.getName().equals("§cConfirm Vote")) {
  29.             e.setCancelled(true);
  30.             if (clicked.getType() == Material.WOOL) {
  31.                 if (clicked == no) {
  32.                     e.setCancelled(true);
  33.                     player.closeInventory();
  34.                     player.sendMessage(ChatColor.RED + "You have canceled your vote!");
  35.                     return;
  36.                 }
  37.                 if (clicked == yes) {
  38.                     e.setCancelled(true);
  39.                     player.closeInventory();
  40.                     player.sendMessage(ChatColor.GREEN +  "Successfully Cast your vote!");
  41.                     PlayerUtils.votes.put(player, Bukkit.getPlayer(inventory.getItem(4).getItemMeta().getDisplayName().substring(2)));
  42.                     player.sendMessage("test " + Bukkit.getPlayer(inventory.getItem(4).getItemMeta().getDisplayName().substring(2)).getName());
  43.                     return;
  44.                 }
  45.             }
  46.         }
  47.         return;
  48.     }
  49. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top