Custom EntityDamageByEntityEvent

Discussion in 'Spigot Plugin Development' started by Bentipa, Jul 8, 2015.

  1. Hello,
    i have to throw a custom EntityDamageByEntityEvent.
    If i shoot an arrow it will "explode" but i want the Shooter of the arrow to get a kill if the explosion killed someone. So i have all Players near the arrow hit, now i want to throw a custom EntityDamageByEntityEvent so if the enemy dies the Shooter gets the kill.
    But however the enemy doesnt get damage at all:
    Code (Text):
                    p.sendMessage("You gotta bit damage by " + damager.getName() +1.5);
                    EntityDamageByEntityEvent ev  = new EntityDamageByEntityEvent(damager, p, DamageCause.PROJECTILE, 1.5);
  2. Let us see more? this doesn't really show me anything of how a player won't be damaged.
  3. ? This is how i try to damage them, there is no Listener blocking the Event and no other Plugin.
    The Problem is, that they dont get the damage.
  4. You're setting the LAST damage, the entity was NEVER damaged in the first place, hence there is no damage to get from LAST TIME the player was damaged.

    You should first do something like p.damage() or w/e first. not even sure this is the best way of doing this, you should think of another way.
    You don't need to create this type of event unless you specifically need to.

    If you want players to get damaged by an explosive arrow by the explosion, then create a fake explosion. Search for players around where the projectile hit, and loop through them and damage them all for however much you want.
  5. 1. I try to damage him by event
    2. Thats what i've done, the problems is the damaging thing, because if i only remove lives, its not that easy to add kills for the player.. Just thought if it is possible with that.
    Thanks anyway :)
  6. EntityDamageByEntityEvent ev = new EntityDamageByEntityEvent(damager, p, DamageCause.PROJECTILE, 1.5);

    needs to be followed by


    But I do not know if Spigot manages Damage after sucha an event is called or before, you ll have to test that
  7. What is missing ?
  8. Try it out. But that should work
  9. I made exactly the same.. ?
    EDIT: Got it, have to put damage AND throw the Event.