Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 31st, 2020 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.b1vth420.busioDiamonds;
  2. import org.apache.commons.lang.CharUtils;
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.Location;
  6. import org.bukkit.Material;
  7. import org.bukkit.block.Block;
  8. import org.bukkit.enchantments.Enchantment;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.event.EventHandler;
  11. import org.bukkit.event.Listener;
  12. import org.bukkit.event.inventory.InventoryClickEvent;
  13. import org.bukkit.inventory.ItemStack;
  14. import org.bukkit.inventory.PlayerInventory;
  15.  
  16. import java.util.*;
  17.  
  18. public class GUIMoveItem implements Listener {
  19.  
  20.     @EventHandler
  21.     public void clickEvent(InventoryClickEvent e) {
  22.  
  23.         List<ItemStack> listavip = new ArrayList<>();
  24.         ItemStack swordv = new ItemStack(Material.IRON_SWORD);
  25.         swordv.addEnchantment(Enchantment.FIRE_ASPECT,2);
  26.         swordv.addEnchantment(Enchantment.DAMAGE_ALL,5);
  27.  
  28.         ItemStack helmv = new ItemStack(Material.DIAMOND_HELMET);
  29.         helmv.addEnchantment(Enchantment.DURABILITY,3);
  30.         helmv.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL,4);
  31.  
  32.         ItemStack chestv = new ItemStack(Material.DIAMOND_CHESTPLATE);
  33.         chestv.addEnchantment(Enchantment.DURABILITY,3);
  34.         chestv.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL,4);
  35.  
  36.         listavip.add(swordv);
  37.         listavip.add(helmv);
  38.         listavip.add(chestv);
  39.  
  40.         List<ItemStack> listasvip = new ArrayList<>();
  41.         ItemStack swordsv = new ItemStack(Material.DIAMOND_SWORD);
  42.         swordsv.addEnchantment(Enchantment.FIRE_ASPECT,2);
  43.         swordsv.addEnchantment(Enchantment.DAMAGE_ALL,5);
  44.  
  45.         listasvip.add(swordsv);
  46.  
  47.         if (e.getClickedInventory()== null) return;
  48.         if (e.getView().getTitle().equalsIgnoreCase(ChatUtil.chat("&b" + "kity"))) {
  49.             Player player = (Player) e.getWhoClicked();
  50.             e.setCancelled(true);
  51.             switch (e.getCurrentItem().getType()){
  52.                 case IRON_HELMET:
  53.                     if (!player.hasPermission("hard.kits.vip")) {
  54.                         player.sendMessage("NIEMASZ PERMISJI (hard.kits.vip) ");
  55.                         break;
  56.                     }
  57.                     player.closeInventory();
  58.                     addItemsToPlayer(player, listavip, player.getLocation());
  59.                     player.sendMessage(ChatUtil.chat("&cUdalo ci sie odebrac kit c:"));
  60.                     break;
  61.                 case GOLDEN_HELMET:
  62.                     if (!player.hasPermission("hard.kits.svip")) {
  63.                         player.sendMessage("NIEMASZ PERMISJI (hard.kits.svip) ");
  64.                         break;
  65.                     }
  66.                     player.closeInventory();
  67.                     addItemsToPlayer(player, listasvip, player.getLocation());
  68.                     player.sendMessage(ChatUtil.chat("&cUdalo ci sie odebrac kit c:"));
  69.                     break;
  70.             }
  71.         }
  72.         return;
  73.     }
  74.  
  75.     void addItemsToPlayer(Player player, Collection<ItemStack> items, Location l){
  76.         PlayerInventory inv = player.getInventory();
  77.         HashMap<Integer, ItemStack> notStored = inv.addItem(items.<ItemStack>toArray(new ItemStack[items.size()]));
  78.         for (Map.Entry<Integer, ItemStack> en : notStored.entrySet())
  79.             l.getWorld().dropItemNaturally(l, en.getValue());
  80.     }
  81. }
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