1.15.2 how to detect if a player has a piece of armor on or not

Discussion in 'Spigot Plugin Development' started by catssss, Mar 27, 2020.

  1. how would I detect if a player has a piece of armor on and how would I give them a effect forever if they do. when I say forever I mean not like infinite time but it will be ten seconds and it will go down to 8 then it will go back up to ten
  2. Create a loop that loops every two seconds, where you check all players armor. If they have the armor you need, give them the potion effect.
  3. how do you make a loop that runs every two seconds
  4. in older version I use org.bukkit.scheduler but i don't know if it's the same in 1.15 :confused:
  5. Both that and creating a BukkitRunnable should work :)
  6. yes of course i forget ^^
    i don't know if it's possible to share youtube link to explain that more visually ^^'
  7. You could use ItemMeta#addAttributeModifier to give effects to an Entity who wears the armor.
  8. can you make the armor give effects with that cause I was gonna do slow fall and also I know the bukkit runnable but is that only in ticks or can you also do time