Code:java @EventHandler(priority = EventPriority.HIGHEST) public void witBicie(EntityDamageByEntityEvent e){ System.out.println("1"); if(e.getDamager() instanceof WitherSkull){ System.out.println("2"); WitherSkull s = (WitherSkull) e.getDamager(); System.out.println("3"); if(s.getShooter() instanceof Wither){ System.out.println("4"); if(e.getEntity() instanceof Player){ System.out.println("5"); Wither shooter = (Wither) s.getShooter(); System.out.println("6"); Player ofiara = (Player) e.getEntity(); System.out.println("7"); e.setCancelled(true); System.out.println("8"); } } } } Not working code :< It's saying 1 2 3 4 5 6 7 8 But don't cancelling event
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.
Can someone explain me what we are trying to do here? Sorry but I can't understand what he wants to do...