PotionSplashEvent player.

Discussion in 'Plugin Development' started by onVoid, May 17, 2014.

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

    onVoid

    I am trying to get the shooter of a potion in PotionSplashEvent but its returning an error
    Code:
    Code:java
    1. @EventHandler
    2. public void onSplash (PotionSplashEvent e){
    3. ThrownPotion potion = e.getPotion();
    4. if (potion.getShooter() instanceof Player){
    5. final Player p = (Player) potion.getShooter();
    6. if (Main.scout.contains(p.getName()) && (potion.getItem().getType() == Material.POTION)){
    7. ItemStack f = e.getPotion().getItem();
    8. if (f.getDurability() == 16418){
    9. if (!p.getInventory().contains(new ItemStack (Material.POTION))){
    10. if (Main.scout.contains(p.getName())){
    11. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plug, new Runnable(){
    12.  
    13. @Override
    14. public void run() {
    15. ItemStack pot = new ItemStack (Material.POTION, 2, (short) 16418);
    16. p.getInventory().addItem(pot);
    17. }
    18. }, 900);
    19. }
    20. }
    21. }
    22. }
    23. }
    24. }


    Error: http://puu.sh/8QKKF.png

    Btw line 258 is if(potion.getShooter()instanceof Player){

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  2. Offline

    Sneling

    onVoid Please post your whole code...
     
  3. Offline

    ZodiacTheories

  4. Offline

    onVoid

    Sneling
    The whole class doesnt matter this is whats causing the error

    ZodiacTheories
    With ProjectileSource, cant get who threw the potion.
     
Thread Status:
Not open for further replies.

Share This Page