Hello everybody! I made a plugin which that adds guns. So, when I right click - gun throws a snowball. But when I'm to close to mob - this snowball doesn't damage mobs. My code: Code: Snowball bullet = attacker.getWorld().spawn(attacker.getEyeLocation(), Snowball.class); bullet.setVelocity(getSpreadVec(attacker).multiply(type.bulletSpeed)); bullet.setShooter(attacker); I also tried this: Code: Projectile ball = attacker.launchProjectile(Snowball.class); ball.setMetadata("SnowballToFire", new FixedMetadataValue(Main.instance, true)); ball.setVelocity(getSpreadVec(attacker).multiply(type.bulletSpeed)); ball.setShooter(attacker); But the result does not change. Video demonstration (Move your mouse to reveal the content) Video demonstration (open) Video demonstration (close) How can I solve this problem? Thanks in advance!
It's almost like the mob had some sort of protection when you were next to him. Do you handle any events in your plugin? Post the classes. Also, Code: Snowball bullet = attacker.getWorld().spawn(attacker.getEyeLocation(), Snowball.class); bullet.setVelocity(getSpreadVec(attacker).multiply(type.bulletSpeed)); bullet.setShooter(attacker); There are references to a variable declared as attacker, and a method named getSpreadVec(). Please post the entire class.
Method onShoot(). Maybe there is a settings in spigot files? I also have Worldguard on my server. But I didn't change the default config. It's also the same situation when I am throwing eggs or snowballs (throw eggs or snowballs by right click with them) But I removed all plugins - nothing changed =(