SHOW:
|
|
- or go back to the newest paste.
1 | - | @EventHandler(priority = EventPriority.HIGHEST) |
1 | + | @EventHandler(priority = EventPriority.HIGHEST) |
2 | - | public void inventoryClick(InventoryClickEvent event){ |
2 | + | public void inventoryClick(InventoryClickEvent event) { |
3 | - | if(event.getWhoClicked() instanceof Player){ |
3 | + | if (!(event.getWhoClicked() instanceof Player)) { |
4 | - | Player p = (Player) event.getWhoClicked(); |
4 | + | return; |
5 | - | if(event.getCurrentItem()!=null){ |
5 | + | } |
6 | - | if(event.getCurrentItem().getType()!=Material.AIR){ |
6 | + | Player p = (Player) event.getWhoClicked(); |
7 | - | event.setCancelled(true); |
7 | + | if (event.getCurrentItem() == null) { |
8 | - | if(event.getCurrentItem().getType()==Material.STONE){ |
8 | + | return; |
9 | - | Inventory inv = Bukkit.getServer().createInventory(p, 54, "Some Name"); |
9 | + | } |
10 | - | p.playSound(p.getLocation(), Sound.ITEM_PICKUP, 10, 2); |
10 | + | if (event.getCurrentItem().getType() == Material.AIR) { |
11 | - | p.openInventory(inv); |
11 | + | return; |
12 | - | } |
12 | + | } |
13 | - | } |
13 | + | event.setCancelled(true); |
14 | - | } |
14 | + | if (event.getCurrentItem().getType() == Material.STONE) { |
15 | - | } |
15 | + | Inventory inv = Bukkit.getServer().createInventory(p, 54, "Some Name"); |
16 | - | } |
16 | + | p.playSound(p.getLocation(), Sound.ITEM_PICKUP, 10, 2); |
17 | p.openInventory(inv); | |
18 | } | |
19 | } |