Hey guys, So I was making an Assassin kit for my KitPvP server. And I would like to make you insta-kill someone if you him him with shears in the back. This is my code currently: http://pastebin.com/jj7UYCLa Thanks in advance!
@Eller What your problem was, was that you were checking if the damagee had the shears. You want to check if damager had the shears so quick fix. Code: @EventHandler public void onBackstab(EntityDamageByEntityEvent e) { if(e.getEntity() instanceof Player && e.getDamager() instanceof Player){ Player d = (Player) e.getDamager(); Player p = (Player) e.getEntity(); // this below was p.getItemInHand().getType() == Material.SHEARS // need to be what it is now if(d.getItemInHand().getType() == Material.SHEARS){ if(p.getLocation().getYaw() > d.getLocation().getYaw()-40 && p.getLocation().getYaw() < d.getLocation().getYaw()+40){ p.setHealth(0); } } } } If this solved your problem than don't forget to set this thread prefix to [Solved] If you think i helped then leave a like
@Ruptur Thanks I'll try it out! I see what I have done wrongly ... Stupid me Thanks for the help ill leave a like