Remove arrows in player?

Discussion in 'Plugin Development' started by robbertie, Nov 26, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    robbertie

    Hello,

    How can I remove the arrows in the player?
    This code isnt working :
    Code:java
    1. ((CraftPlayer)player).getHandle().getDataWatcher().watch(9, (byte) 0);
     
  2. Offline

    RawCode

    Code:
                                if (!this.world.isStatic) {
                                    entityliving.m(entityliving.aU() + 1);
                                }
    how arrowcount set internally by game on arrow hit, now you have method for this.
     
  3. Offline

    xTrollxDudex

    robbertie
    Stop bumping your thread -_- you can only bump ONCE every 24 hours.

    You should track the arrows in a player and loop through them executing Entity#remove()
     
  4. Offline

    robbertie

    Sorry xTrollxDudex , but can you please give an example?

    RawCode sorry I dont get it

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  5. Offline

    Plo124

    robbertie
    Code:java
    1. for (Entity e : p.getNearbyEntities(1, 1, 1)){
    2. if (e instanceof Arrow){
    3. e.remove();
    4. }
    5. }
    6.  
     
    NathanWolf likes this.
  6. Offline

    robbertie

    Plo124 what do you mean with p ? Because it doesnt work
     
  7. Offline

    arigatou

    robbertie

    p is the Player variable of the player who you're trying to remove arrows from.
     
  8. Offline

    DarkBladee12

    robbertie p is obviously the player from whose body you want to remove the arrows.
     
  9. Offline

    robbertie

    Ok thanks I will try that

    DarkBladee12 arigatou Plo124 How can I make this when a arrow hit a player?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  10. Offline

    Chinwe

    robbertie
    EntityDamageByEntityEvent will fire when a player is hit by any entity (including projectiles/arrows), so you will need to check that the damager is an arrow, and that the damagee/entity that is being damaged is a player :)
     
  11. Offline

    robbertie

    Thanks! Chinwe

    It doesnt work :-/ it just dont remove the arrows Chinwe Plo124

    Please help...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
Thread Status:
Not open for further replies.

Share This Page