Guns Plugin

Discussion in 'Plugin Development' started by VENTO, Dec 15, 2016.

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

    VENTO

    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 (open)


    How can I solve this problem?
    Thanks in advance!
     
  2. Snowballs do not do any damage.
     
  3. Offline

    HeartandSoul

    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.
     
  4. Offline

    VENTO

    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 =(
     

    Attached Files:

    Last edited: Dec 16, 2016
Thread Status:
Not open for further replies.

Share This Page