NotCachaaaaaaaaaa

Untitled

Mar 19th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. @EventHandler
  2. public void onClick(InventoryClickEvent e) {
  3. Player player = (Player) e.getWhoClicked();
  4. FileConfiguration config = plugin.getConfig();
  5. String name = config.getString("Inventory-Selector.Title");
  6. String nname = ChatColor.stripColor(name);
  7. if (ChatColor.stripColor(e.getInventory().getName()).equals(nname)) {
  8. if (e.getCurrentItem() == null || e.getSlotType() == null || e.getCurrentItem().getType() == Material.AIR) {
  9. e.setCancelled(true);
  10. return;
  11. } else {
  12. for(String a : config.getConfigurationSection("Inventory-Selector.Items").getKeys(false)){
  13. int slot = config.getInt("Inventory-Selector.Items." + a + ".Slot");
  14. List<String> command = config.getStringList("Inventory-Selector.Items." + a + ".Commands");
  15. if(e.getSlot() == slot){
  16. ActionUtil.executeActions(player,command);
  17. e.setCancelled(true);
  18. }
  19. }
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment