Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. @EventHandler(priority = EventPriority.MONITOR)
  2. public void onInventoryClick(InventoryClickEvent e) {
  3. if (e.getWhoClicked() instanceof Player) {
  4. Player p = (Player) e.getWhoClicked();
  5. int[] _cancel = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 };
  6. int[] cancel = { 45, 46, 47, 51, 52, 53 };
  7. int x;
  8. int size1 = 54;
  9. int size2 = 36;
  10.  
  11. Inventory inv = p.getOpenInventory().getTopInventory();
  12. String invName = plugin.getInvName("Name");
  13. String binvName = plugin.getInvName1("Name");
  14.  
  15. if ((inv.getTitle().contains(binvName)) && (inv.getSize() == size1)) {
  16. for (x = 0; x < cancel.length; x++) {
  17. if (cancel[x] == e.getSlot()) {
  18. e.setCancelled(true);
  19. break;
  20. }
  21. }
  22. }
  23. if ((inv.getTitle().contains(invName)) && (inv.getSize() == size2)) {
  24. for (x = 0; x < _cancel.length; x++) {
  25. if (_cancel[x] == e.getSlot()) {
  26. e.setCancelled(true);
  27. break;
  28. } else if (e.getSlot() == 10) {
  29. p.closeInventory();
  30. blocksInv(p);
  31. }
  32. }
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement