lanch projectile error

Discussion in 'Plugin Development' started by Unknown_Stalker_, Jan 19, 2014.

Thread Status:
Not open for further replies.
  1. Code:java
    1. package me.UnknownStalker.kitpvp.kitListeners;
    2.  
    3. import org.bukkit.entity.Player;
    4. import org.bukkit.entity.ThrownPotion;
    5. import org.bukkit.event.EventHandler;
    6. import org.bukkit.event.Listener;
    7. import org.bukkit.event.player.PlayerInteractEvent;
    8. import org.bukkit.potion.PotionEffect;
    9. import org.bukkit.potion.PotionEffectType;
    10.  
    11. public class MagicianListener implements Listener{
    12.  
    13.  
    14.  
    15. @EventHandler
    16. public void onPlayerInteract(PlayerInteractEvent e){
    17. Player player = e.getPlayer();
    18. player.launchProjectile(ThrownPotion.class).getEffects().add(new PotionEffect(PotionEffectType.HARM, 0, 1));
    19.  
    20. }
    21. }
    22.  

    it launches the potion but not the potion effect, no console errors
     
  2. Offline

    Maurdekye

    You should create a potion object, and then drop it into the world and change it's velocity to reflect the player's direction.
     
  3. i tried that still nothing

    bumpp

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  4. new PotionEffect(PotionEffectType.HARM, 0, 1)

    Harming 1 potion for 0 ticks.
     
  5. Offline

    BlueMustache

    Do you have a copy of your latest.log?
    I made a plugin like this.
    Does this help, otherwise, I need a copy of your latest.log to diagnose the error.

    Code:java
    1. private void fireGhast(Player p)
    2. {
    3. p.launchProjectile(Fireball.class);
    4. p.getLocation().getWorld().playSound(p.getLocation(), Sound.GHAST_FIREBALL, 1.0F, 1.0F);
    5. p.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.FIREBALL) });
    6. if (Bukkit.getPluginManager().getPlugin("DisguiseCraft") != null)
    7. runOp(p, "d ghast");
    8. }
     
  6. that wouldn't matter
    it doesn't help, i'm trying to make the potion a specific potion, then it just splashes as a normal potion
     
  7. try harming 1 for 1 tick.
     
  8. tried that as we'll still nothing
     
Thread Status:
Not open for further replies.

Share This Page