Advertisement
thevipershowita

ClickLIstener.java

Jul 6th, 2019
491
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. package me.tylercreator.guichunk.listener;
  2.  
  3. import org.bukkit.entity.Player;
  4. import org.bukkit.event.EventHandler;
  5. import org.bukkit.event.Listener;
  6. import org.bukkit.event.inventory.InventoryClickEvent;
  7.  
  8. import me.tylercreator.guichunk.Main;
  9. import me.tylercreator.guichunk.ui.gui;
  10.  
  11. public class ClickListener implements Listener {
  12.    
  13.     private Main plugin;
  14.    
  15.     public ClickListener(Main plugin) {
  16.         this.plugin = plugin;
  17.    
  18.     }
  19.    
  20.     @EventHandler
  21.     public void onClick(InventoryClickEvent e) {
  22.        
  23.         String title = e.getInventory().getTitle();
  24.         if (title.equals(gui.inventory_name)) {
  25.             e.setCancelled(true);
  26.             if (e.getCurrentItem() == null) {
  27.                 return;
  28.             }
  29.             if (title.equals(gui.inventory_name)) {
  30.                 gui.clicked((Player) e.getWhoClicked(), e.getSlot(), e.getCurrentItem(), e.getInventory());
  31.             }
  32.         }
  33.        
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement