Drink Potion and Splash Potion Events

Discussion in 'Plugin Development' started by Kieraaaan, Oct 25, 2016.

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

    Kieraaaan

    Hello everyone. I am developing a plugin but I have come across a problem that I cannot seem to solve and the answers are not around the internet.

    I type onPotionDrink(PlayerItemConsumeEvent e) which then allows me to use e.sendMessage("whatever message there is") but when I use the (PotionSplashEvent e) it doesn't allow me to use commands like e.sendMessage("message")

    could you help me find a solution to this please.

    - Kieraaaan
     
  2. Offline

    theone1000

    That's because you need to get the entity from e#getPotion#getShooter() then check if the entity is instanceof Player if so, cast the shooter to a player.
     
    Last edited: Oct 25, 2016
Thread Status:
Not open for further replies.

Share This Page