How to use launchProjectile with an itemstack?

Discussion in 'Plugin Development' started by Stenox, Jan 26, 2020.

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

    Stenox

    First of all I would like to say that I am Brazilian and I am speaking for the translator, so if the translation gets bad sorry

    My problem is this: If I put "player.launchProjectile(Snowball.class);" the plugin works normally, but the code doesn't work, how can I make a snowball with a metadata and launch it?

    Snowball snowball = (Snowball) new ItemStack(Material.SNOW_BALL);
    snowball.setMetadata(arma.getTipo().getMeta(), new FixedMetadataValue(Main.getPlugin(), "stenox"));
    player.launchProjectile(snowball.getClass());
     
  2. Offline

    KarimAKL

    @Stenox Simply use this:
    Code:Java
    1. Snowball snowball = player.launchProjectile(Snowball.class);
    2. snowball.setMetadata(...);
     
Thread Status:
Not open for further replies.

Share This Page