if the potion, that the player hold in hand, is a water potion, then it return null, not PotionType.WATER.
For now i use the check for null and set the message in code to "Water"
t. hartmann
added a comment - - edited hi, i create the ItemStack with:
player.getItemInHand();
if the potion, that the player hold in hand, is a water potion, then it return null, not PotionType.WATER.
For now i use the check for null and set the message in code to "Water"
Potion.fromItemStack() gets the Potion from Potion.fromDamage(). fromDamage() can return a Potion with a null PotionType when the given damage doesn't correspond with a Potion. fromItemStack() uses the item's durability (or damage value) for this. You probably have an itemstack with a weird durability for some reason. The bug here is probably just poor documentation.
If that's not the issue please show the ItemStacks you are using to create the Potion.
DemonWav
added a comment - Potion.fromItemStack() gets the Potion from Potion.fromDamage(). fromDamage() can return a Potion with a null PotionType when the given damage doesn't correspond with a Potion. fromItemStack() uses the item's durability (or damage value) for this. You probably have an itemstack with a weird durability for some reason. The bug here is probably just poor documentation.
If that's not the issue please show the ItemStacks you are using to create the Potion.
Your build is not the latest and therefore may be the reason you are having this issue. Spigot is 1 version(s) behind. CraftBukkit is 1 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue.
SpigotMC
added a comment - Your build is not the latest and therefore may be the reason you are having this issue. Spigot is 1 version(s) behind. CraftBukkit is 1 version(s) behind. This message was automatically generated and is not guaranteed to be a solution to your issue.
hi, i create the ItemStack with:
if the potion, that the player hold in hand, is a water potion, then it return null, not PotionType.WATER.
For now i use the check for null and set the message in code to "Water"