Merge branch 'issue-232' of https://github.com/sainttx/Essentials into 2.x

This commit is contained in:
vemacs 2015-11-08 07:59:47 -07:00
commit 9bf0b65016
2 changed files with 9 additions and 1 deletions

View File

@ -312,7 +312,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb {
Potion potion = Potion.fromItemStack(is);
for (PotionEffect e : potion.getEffects()) {
// long but needs to be effect:speed power:2 duration:120 in that order.
sb.append("effect:").append(e.getType().getName().toLowerCase()).append(" ").append("power:").append(e.getAmplifier()).append(" ").append("duration:").append(e.getDuration() / 20).append(" ");
sb.append("splash:").append(potion.isSplash()).append(" ").append("effect:").append(e.getType().getName().toLowerCase()).append(" ").append("power:").append(e.getAmplifier()).append(" ").append("duration:").append(e.getDuration() / 20).append(" ");
}
break;
case SKULL_ITEM:

View File

@ -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();
}
}