How would you check id a player is wear a type od armour and if they take it off and put diferent armour on. so if they are wearing full leather it would give them speed 3 but if theyre missing leather boots, helm chest plate etc they wouldnt have an effect thanks in advance
But anyways, I understood the question. Use if statements to either check the item meta, or the item display name. Other than that, the only other way is to check if the item is an instance of a subclass of an ItemStack which from my experience, is a lot more work, and you will come out with a lot more listeners to work with which isn't really efficient.
so i would check if the player .getHelmet.getType() == Diamond_Helmet.getDisplayName("Diamond Helment") then give them the effect or something similar i'm guessing
You would do: player.getInventory().getHelmet().getItemMeta().getDisplayName().equals(<"whatever name you are looking for">)) You don't compare Strings with ==
Just a waste of time. Just check if the player is wearing leatherboots, leatherchestplate etc. Then do stuff. If you have a custom ItemStack, you check also for the displayname, but you weren't.
Each time an InventoryClick is fired, check if the armor slots have changed a tick later - and if they either create a full set or break one. Then simply change that in a Set/Map (if you have only one effect, a Set will suffice. But if you have multiple effects - for example speed I with leather armor and speed II with iron armor, you will need a Map). Lastly, have a global runnable which updates the effects of people every tick / second / x seconds.
This was only meant for if you wanted the armor to be of a specified type with a specified name, if you really just want the type of armor to be checked then you only need to compare the type
The mapping part : "change that in a Set/Map (if you have only one effect," also could you check my other thread i need help with :s
When they have a complete set of armor after a InventoryClickEvent, add them to a Set / put their player with the effect type in the Map. If they do not, remove it from the Set / Map
}else{ e.setCancelled(true); p.updateInventory(); p.sendMessage(ChatColor.AQUA + "You must wait " + ChatColor.YELLOW + ChatColor.BOLD + cooldown.get(p) + ChatColor.AQUA + " seconds before you enderpearl again!"); if(p.getInventory().contains(Material.ENDER_PEARL)){ ItemStack ep = new ItemStack(Material.ENDER_PEARL); ItemMeta meta = ep.getItemMeta(); meta.setDisplayName("§eEnderpearl Cooldown: §c" + cooldown.get(p)); ep.setItemMeta(meta); p.getInventory().remove(Material.ENDER_PEARL); p.getInventory().addItem(ep); How would i get the amount of enderpearls the player the player previously had then once the cooldown finishes put it to the right amount
You are never going to learn unless you debug on your own. By the fact that you didn't even know that Strings are only to be compared with ==, shows signs of needing improvement in your knowledge of programming. Please learn the Java API first before moving on to things like bukkit, or you will just make it hard for yourself. I mean this in the nicest way possible...