Advertisement
riking

Untitled

May 14th, 2014
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     @EventHandler(priority = EventPriority.HIGHEST)
  2.     public void inventoryClick(InventoryClickEvent event) {
  3.         if (!(event.getWhoClicked() instanceof Player)) {
  4.             return;
  5.         }
  6.         Player p = (Player) event.getWhoClicked();
  7.         if (event.getCurrentItem() == null) {
  8.             return;
  9.         }
  10.         if (event.getCurrentItem().getType() == Material.AIR) {
  11.             return;
  12.         }
  13.         event.setCancelled(true);
  14.         if (event.getCurrentItem().getType() == Material.STONE) {
  15.             Inventory inv = Bukkit.getServer().createInventory(p, 54, "Some Name");
  16.             p.playSound(p.getLocation(), Sound.ITEM_PICKUP, 10, 2);
  17.             p.openInventory(inv);
  18.         }
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement