EntityDamage

Discussion in 'Plugin Development' started by Plugers11, May 22, 2014.

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

    Plugers11

    Code:java
    1. @EventHandler(priority = EventPriority.HIGHEST)
    2. public void witBicie(EntityDamageByEntityEvent e){
    3. System.out.println("1");
    4. if(e.getDamager() instanceof WitherSkull){
    5. System.out.println("2");
    6. WitherSkull s = (WitherSkull) e.getDamager();
    7. System.out.println("3");
    8.  
    9. if(s.getShooter() instanceof Wither){
    10. System.out.println("4");
    11. if(e.getEntity() instanceof Player){
    12. System.out.println("5");
    13. Wither shooter = (Wither) s.getShooter();
    14. System.out.println("6");
    15. Player ofiara = (Player) e.getEntity();
    16. System.out.println("7");
    17. e.setCancelled(true);
    18. System.out.println("8");
    19. }
    20. }
    21. }
    22. }
    23.  
    24.  
    25.  


    Not working code :<
    It's saying
    1
    2
    3
    4
    5
    6
    7
    8

    But don't cancelling event
     
  2. Offline

    THEREDBARON24

    Strange, unless you are trying to do other things with the player and Wither, there is no reason to define them and therefore create objects that will never be used. perhaps you could remove the damager with s.remove Another improvement could be changing instaceof statements to entity.getType == EnityType.whatever.
     
  3. Offline

    mine-care

    What you want it to do?
     
  4. Offline

    oaschi

    Maybe another plugin uncancelling the event?
     
  5. Offline

    mine-care

    Can someone explain me what we are trying to do here?
    Sorry but I can't understand what he wants to do...
     
Thread Status:
Not open for further replies.

Share This Page