Solved How to damage all entities?

Discussion in 'Spigot Plugin Development' started by TheGamerPlayz, Jun 1, 2016.

Thread Status:
Not open for further replies.
  1. I got all the entities into a list, and am getting them one by one in a for loop and I'd like to damage each of them and set their damager to a player. How would I do that other than getting each one individually?
     
  2. Something like this should do the trick.
    Code (Text):
            Entity yourPlayer = null;
            LivingEntity yourPlayerLivingEntity = (LivingEntity) yourPlayer;
            for (Entity e : entities){
                yourPlayerLivingEntity.damage(2.0, e);
            }
     
    • Informative Informative x 1
  3. Thats perfect, thanks:)
     
Thread Status:
Not open for further replies.