SHARE
TWEET

Untitled

a guest Aug 25th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package listener;
  2.  
  3. import org.bukkit.Material;
  4. import org.bukkit.entity.Player;
  5. import org.bukkit.event.EventHandler;
  6. import org.bukkit.event.Listener;
  7. import org.bukkit.event.inventory.InventoryClickEvent;
  8. import org.bukkit.inventory.Inventory;
  9. import org.bukkit.inventory.ItemStack;
  10.  
  11. public class ItemClick_Listener implements Listener {
  12.     @EventHandler
  13.     public void inInventoryClick(InventoryClickEvent e) {
  14.         Player p = (Player) e.getWhoClicked();
  15.         ItemStack clicked = e.getCurrentItem();
  16.         Inventory inventory = e.getInventory();
  17.         if(inventory.getName().equals("§cTest")) {
  18.             if(clicked.getType() == Material.BEACON) {
  19.                 p.sendMessage("Test");
  20.                 e.setCancelled(true);
  21.                 }
  22.  
  23.             } else {
  24.                 p.closeInventory();
  25.             }
  26.         }
  27.  
  28.     }
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