Solved 1.9 Splash Potion?

Discussion in 'Plugin Development' started by Sulphate, May 2, 2016.

Thread Status:
Not open for further replies.
  1. I've been searching for ages but still can't find anything on how to create a splash potion in 1.9 using non-deprecated methods. I can create normal potions with no problem. Any help?
     
  2. Offline

    WolfMage1

    I think there's a Potion#setSplash or Potion#splash something like that.
     
  3. For 1.8 there is, in 1.9 it's been deprecated (may be removed or functionality may be different in future updates).
     
  4. Offline

    Zombie_Striker

    @Sulphate
    Deprecated means that "you should be aware you MAY not want to use it", not that you cannot use it. It is meant to alert devs that changes may happen, such as removing the method or converting the way objects are stored. Since bukkit and spigot don't normally remove methods, you don't have to worry about deprecation.
     
  5. Offline

    redtsch

    I think this should work if you want to add an item to a player's inventory:

    Code:
    ItemStack item = new ItemStack(373, 1, (short) 16396);
    inv.addItem(item);
    
    16396 = extension number of the potion your giving "EX: 373:16396" Would give you a splash harming potion
    373 = main id of a water bottle
    1 = Amount Of Item
     
  6. Alright, thanks :) So to be clear, there is no non-deprecated method for creating potions in 1.9?
     
  7. Offline

    Lordloss

    This doesnt work since 1.9
     
  8. Offline

    redtsch

    Ah ok, sorry. I hadn't tested that out yet. Sorry again! :)
     
  9. Offline

    Lordloss

    @Sulphate
    Yes there are non-deprecated methods:
    Create an itemStack with Material.SPLASH_POTION
    Get the potionMeta, add effects, set the meta back again.
     
  10. Thank you so much <3
     
    Lordloss likes this.
Thread Status:
Not open for further replies.

Share This Page