How can i do that when you put armor in your kit that you automatic get putted on? Code: public void onEnable() { getServer().getPluginManager().registerEvents(this, this); try { saveConfig(); setupConfig(getConfig()); saveConfig(); } catch (Exception e) { e.printStackTrace(); } } @SuppressWarnings("deprecation") public boolean onCommand(CommandSender sender, Command command, String cmd, String[] args) { if (cmd.equalsIgnoreCase("minekit")) { if (sender instanceof Player) { Player p = (Player) sender; if (args.length == 0) { String[] classes = getConfig().getString("Kits.Namen").split(","); for (String s : classes) { if (s != null) { p.sendMessage("[" + ChatColor.AQUA + s + ChatColor.WHITE + "] " + ChatColor.GRAY + ": " + ChatColor.DARK_GRAY + "Geeft je de " + s + " kit!"); } } } else { int i = 0; for (String s : getConfig().getConfigurationSection("Kits").getKeys(false)) { i++; if (args[0].equalsIgnoreCase(s)) { if (p.hasPermission("minekits." + s)) { p.getInventory().clear(); try { String items = getConfig().getString("Kits." + s + ".Items"); String[] indiItems = items.split(","); for (String s1 : indiItems) { String[] itemAmounts = s1.split("-"); ItemStack item = new ItemStack(Integer.valueOf(itemAmounts[0]), Integer.valueOf(itemAmounts[1])); p.getInventory().addItem(item); } p.updateInventory(); } catch (Exception e) { e.printStackTrace(); } } else { p.sendMessage(ChatColor.RED + "Je hebt hier geen permissies voor!"); } } } } } } return false; } private void setupConfig(FileConfiguration config) throws IOException { if (!new File(getDataFolder(), "RESET.FILE").exists()) { config.set("Kits.Mage.Items", "50-64,278-1,277-4"); config.set("Kits.Archer.Items", "64-64,1-1,5-4"); config.set("Kits.Namen", "Mage,Archer"); new File(getDataFolder(), "RESET.FILE").createNewFile(); } }
This part i already know. But the code is a kit menu. You can make your own kits in the config but there can be 0 armor. But if someone add the id of the armor how can i check that?