Kewilleen

trow_v2

Oct 1st, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.13 KB | None | 0 0
  1. @EventHandler
  2.     public void quandoInteragirOsItensComUmJogador(PlayerInteractEntityEvent e) {
  3.         if (((e.getPlayer() instanceof Player)) && ((e.getRightClicked() instanceof Player))) {
  4.             Player p = e.getPlayer();
  5.             Player p1 = (Player) e.getRightClicked();
  6.             ItemStack item = p.getItemInHand();
  7.             String pp, invs, padrao, ban;
  8.             int id1, id3;
  9.             pp = p.getName();
  10.             padrao = "StaffMode.Itens.";
  11.             invs = padrao + "Inventario.";
  12.             ban = padrao + "Ban.";
  13.             id1 = cnf.getInt(invs + "ID");
  14.             id3 = cnf.getInt(ban + "ID");
  15.             if (staffmode.contains(pp)) {
  16.                 if (item.getTypeId() == id1) {
  17.                     if (cnf.getBoolean(invs + "Ativar") == true) {
  18.                         p.openInventory(KwMetodos.getInv(p1));
  19.                     } else {
  20.                         p.chat("/openinv " + p1.getName());
  21.                     }
  22.                     return;
  23.                 }
  24.                 if (item.getTypeId() == id3) {
  25.                     p.openInventory(KwUtils.getInv(p1));
  26.                     return;
  27.                 }
  28.             }
  29.         }
  30.     }
  31.  
  32.     @EventHandler
  33.     public void quandoRemover(InventoryClickEvent e) {
  34.         if (e.getWhoClicked() instanceof Player) {
  35.             Player p = (Player) e.getWhoClicked();
  36.             String pp = p.getName();
  37.             Inventory inv, invs, inve;
  38.             ItemStack i = e.getCurrentItem();
  39.             invs = e.getInventory();
  40.             inv = Bukkit.getServer().createInventory(null, cnf.getInt("StaffMode.Itens.Inventario.Tamanho"),
  41.                     KwMetodos.getReplaced("StaffMode.Itens.Inventario.Nome_Inv"));
  42.             inve = Bukkit.getServer().createInventory(null, cnf.getInt("StaffMode.Itens.Ban.GUI.Tamanho"),
  43.                     KwMetodos.getReplaced("StaffMode.Itens.Ban.GUI.Nome"));
  44.             String s, h, o, n, d, cmd1, cmd2, cmd3, cmd4;
  45.             s = "StaffMode.Itens.Ban.Itens.";
  46.             h = s + "Hacker.";
  47.             int id1, id2, id3, id4;
  48.             id1 = cnf.getInt(h + "ID");
  49.             if (staffmode.contains(pp)) {
  50.                 if (invs.getName().equalsIgnoreCase(inv.getName())) {
  51.                     e.setCancelled(true);
  52.                 }
  53.                 if (invs.getName().equalsIgnoreCase(inve.getName())) {
  54.                     if (i != null) {
  55.                         if (i.getTypeId() == id1) {
  56.                             cmd1 = cnf.getString(h + "Comando").replace("{p}", p.getName());
  57.                             m.dispatchCommand(p, cmd1);
  58.                             return;
  59.                         }
  60.                         e.setCancelled(true);
  61.                     } else {
  62.                         e.setCancelled(true);
  63.                     }
  64.                 }
  65.             }
  66.         }
  67.     }
Advertisement
Add Comment
Please, Sign In to add comment