mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-03 04:21:37 +00:00
[Fix] Adds splash potion persistence when serializing items. Fixes #232
This commit is contained in:
parent
fb4af9fefc
commit
607f1980a1
2 changed files with 9 additions and 1 deletions
|
@ -15,6 +15,7 @@ import org.bukkit.block.banner.PatternType;
|
|||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.*;
|
||||
import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
|
@ -47,6 +48,7 @@ public class MetaItemStack {
|
|||
private boolean validPotionEffect = false;
|
||||
private boolean validPotionDuration = false;
|
||||
private boolean validPotionPower = false;
|
||||
private boolean isSplashPotion = false;
|
||||
private boolean completePotion = false;
|
||||
private int power = 1;
|
||||
private int duration = 120;
|
||||
|
@ -85,6 +87,7 @@ public class MetaItemStack {
|
|||
validPotionEffect = false;
|
||||
validPotionDuration = false;
|
||||
validPotionPower = false;
|
||||
isSplashPotion = false;
|
||||
completePotion = true;
|
||||
}
|
||||
|
||||
|
@ -333,6 +336,8 @@ public class MetaItemStack {
|
|||
} else {
|
||||
throw new Exception(tl("invalidPotionMeta", split[1]));
|
||||
}
|
||||
} else if (split[0].equalsIgnoreCase("splash") || allowShortName && split[0].equalsIgnoreCase("s")) {
|
||||
isSplashPotion = Boolean.valueOf(split[1]);
|
||||
}
|
||||
|
||||
if (isValidPotion()) {
|
||||
|
@ -343,6 +348,9 @@ public class MetaItemStack {
|
|||
}
|
||||
pmeta.addCustomEffect(pEffect, true);
|
||||
stack.setItemMeta(pmeta);
|
||||
Potion potion = Potion.fromItemStack(stack);
|
||||
potion.setSplash(isSplashPotion);
|
||||
potion.apply(stack);
|
||||
resetPotionMeta();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue