How to detect if player has turned villager zombie into villager

Discussion in 'Spigot Plugin Development' started by bys1, Jun 22, 2016.

  1. Hi,

    How would I detect if a player has turned a villager zombie into a villager using weakness and a golden apple? Does Spigot have some kind of an event for that?
  2. I don't believe there is an event that handles this scenario. You'd probably have to use PlayerInteractEntityEvent, check to see if the item in their hand is a golden apple, check to see if the clicked entity was a zombie villager, save the ZombieVillager entity, wait a few ticks using a runnable, check to see if the entity is now a regular villager. That might not be the best/perfect way to do it, but it's a general outline that should work.
    • Agree Agree x 1
    • Agree Agree x 2
    • Like Like x 1
  3. Oh yea, look at that. OP, I would definitely try this method out first before anything else. Very little coding, and room for error if it works like you need.