Hello. Dumb question lol. I'm attempting to rework arrows entirely and base it off the force of the arrow, but am confused on changing the knockback of them. According to the docs (which yes is for 1.7.10, but since I'm working with 1.8.9 and Spigot docs are blocked on my laptop, it's fine haha) getKnockbackStrength() is based on Punch, so would getKnockbackStrength() for a non-enchanted bow return 0? Essentially, I want to set the knockback of the arrow to be dependent on the force of the arrow (which I can get via a map of when I store the force from BowShootEvent) and the current knockback of the arrow. Code:java @EventHandler public void onEntityDamage(EntityDamageByEntityEvent event) { if (event.getDamager() instanceof Arrow) { Arrow arrow = (Arrow) event.getDamager(); if (force.containsKey(arrow.getUniqueId())) { Bukkit.getLogger().info("FOR TESTING. Force contained " + arrow.getUniqueId() + ". Applied force of " + 2 * force.get(arrow.getUniqueId())); //Player player = (Player) event.getEntity(); event.setCancelled(true); double forcee = force.get(arrow.getUniqueId()); event.setDamage(2 * forcee); Vector vector = arrow.getVelocity(); arrow.setVelocity(vector.multiply(1.2)); int curKb = arrow.getKnockbackStrength(); int kb = (int) (forcee + curKb); arrow.setKnockbackStrength(kb); } } else { return; } }
@Xp10d3 I believe your issue is that you are cancelling the event, therefore, cancelling the knockback and damage. Just don't cancel the event.