Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onClick(InventoryClickEvent e) {
- Player player = (Player) e.getWhoClicked();
- FileConfiguration config = plugin.getConfig();
- String name = config.getString("Inventory-Selector.Title");
- String nname = ChatColor.stripColor(name);
- if (ChatColor.stripColor(e.getInventory().getName()).equals(nname)) {
- if (e.getCurrentItem() == null || e.getSlotType() == null || e.getCurrentItem().getType() == Material.AIR) {
- e.setCancelled(true);
- return;
- } else {
- for(String a : config.getConfigurationSection("Inventory-Selector.Items").getKeys(false)){
- int slot = config.getInt("Inventory-Selector.Items." + a + ".Slot");
- List<String> command = config.getStringList("Inventory-Selector.Items." + a + ".Commands");
- if(e.getSlot() == slot){
- ActionUtil.executeActions(player,command);
- e.setCancelled(true);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment