SHARE
TWEET

Untitled

a guest Jul 21st, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.nxitems.events;
  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.event.inventory.InventoryType;
  9. import org.bukkit.inventory.ItemStack;
  10.  
  11. import static me.nxitems.utils.items.SetEffect.offEffect;
  12. import static me.nxitems.utils.items.SetEffect.onEffect;
  13.  
  14. public class AllowEffect implements Listener {
  15.  
  16.     @EventHandler
  17.     public void onIClick(InventoryClickEvent e) {
  18.  
  19.         Player p = (Player) e.getWhoClicked();
  20.  
  21.         if(e.getSlotType() == InventoryType.SlotType.ARMOR) {
  22.  
  23.             ItemStack helmet = p.getInventory().getHelmet();
  24.             ItemStack chestplate = p.getInventory().getHelmet();
  25.             ItemStack leg = p.getInventory().getHelmet();
  26.             ItemStack boot = p.getInventory().getHelmet();
  27.  
  28.             Material cursor = e.getCursor().getType();
  29.  
  30.             Material click = e.getCurrentItem().getType();
  31.  
  32.             if (helmet == null || chestplate == null || leg == null || boot == null) {
  33.                 if (cursor == Material.DIAMOND_HELMET || cursor == Material.GOLD_HELMET || cursor == Material.IRON_HELMET || cursor == Material.LEATHER_HELMET || cursor == Material.CHAINMAIL_HELMET ||
  34.                 cursor == Material.DIAMOND_CHESTPLATE || cursor == Material.GOLD_CHESTPLATE || cursor == Material.IRON_CHESTPLATE || cursor == Material.LEATHER_CHESTPLATE || cursor == Material.CHAINMAIL_CHESTPLATE) {
  35.  
  36.                     onEffect(p, e);
  37.  
  38.                 }
  39.  
  40.             }else {
  41.                 if (cursor == Material.DIAMOND_HELMET || cursor == Material.GOLD_HELMET || cursor == Material.IRON_HELMET || cursor == Material.LEATHER_HELMET || cursor == Material.CHAINMAIL_HELMET ||
  42.                         cursor == Material.DIAMOND_CHESTPLATE || cursor == Material.GOLD_CHESTPLATE || cursor == Material.IRON_CHESTPLATE || cursor == Material.LEATHER_CHESTPLATE || cursor == Material.CHAINMAIL_CHESTPLATE) {
  43.  
  44.                     onEffect(p, e);
  45.  
  46.                 }else
  47.                 if (click == Material.DIAMOND_HELMET || click == Material.GOLD_HELMET || click == Material.IRON_HELMET || click == Material.LEATHER_HELMET || click == Material.CHAINMAIL_HELMET ||
  48.                         click == Material.DIAMOND_CHESTPLATE || click == Material.GOLD_CHESTPLATE || click == Material.IRON_CHESTPLATE || click == Material.LEATHER_CHESTPLATE || click == Material.CHAINMAIL_CHESTPLATE) {
  49.                     if (e.getCurrentItem().getItemMeta().getDisplayName() != null && e.getCurrentItem().getItemMeta().getLore() != null) {
  50.  
  51.                         offEffect(p, e);
  52.  
  53.                     }
  54.                 }
  55.             }
  56.         }
  57.     }
  58. }
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