mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-02 20:11:44 +00:00
Fix splash potion support for /potion
. Resolves #1166
This commit is contained in:
parent
50e2d27d5b
commit
b6aea0a5f8
2 changed files with 21 additions and 5 deletions
|
@ -7,6 +7,7 @@ import com.earth2me.essentials.utils.FormatUtil;
|
|||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.google.common.base.Joiner;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.nms.refl.ReflUtil;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.bukkit.Color;
|
||||
|
@ -392,9 +393,17 @@ public class MetaItemStack {
|
|||
}
|
||||
pmeta.addCustomEffect(pEffect, true);
|
||||
stack.setItemMeta(pmeta);
|
||||
Potion potion = Potion.fromItemStack(stack);
|
||||
potion.setSplash(isSplashPotion);
|
||||
potion.apply(stack);
|
||||
if (ReflUtil.getNmsVersionObject().isHigherThanOrEqualTo(ReflUtil.V1_9_R1)) {
|
||||
if (isSplashPotion && stack.getType() != Material.SPLASH_POTION) {
|
||||
stack.setType(Material.SPLASH_POTION);
|
||||
} else if (!isSplashPotion && stack.getType() != Material.POTION) {
|
||||
stack.setType(Material.POTION);
|
||||
}
|
||||
} else {
|
||||
Potion potion = Potion.fromItemStack(stack);
|
||||
potion.setSplash(isSplashPotion);
|
||||
potion.apply(stack);
|
||||
}
|
||||
resetPotionMeta();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue