mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-09 20:41:23 +01:00
Merge branch 'issue-232' of https://github.com/sainttx/Essentials into 2.x
This commit is contained in:
commit
9bf0b65016
@ -312,7 +312,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb {
|
|||||||
Potion potion = Potion.fromItemStack(is);
|
Potion potion = Potion.fromItemStack(is);
|
||||||
for (PotionEffect e : potion.getEffects()) {
|
for (PotionEffect e : potion.getEffects()) {
|
||||||
// long but needs to be effect:speed power:2 duration:120 in that order.
|
// 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;
|
break;
|
||||||
case SKULL_ITEM:
|
case SKULL_ITEM:
|
||||||
|
@ -15,6 +15,7 @@ import org.bukkit.block.banner.PatternType;
|
|||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.*;
|
import org.bukkit.inventory.meta.*;
|
||||||
|
import org.bukkit.potion.Potion;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ public class MetaItemStack {
|
|||||||
private boolean validPotionEffect = false;
|
private boolean validPotionEffect = false;
|
||||||
private boolean validPotionDuration = false;
|
private boolean validPotionDuration = false;
|
||||||
private boolean validPotionPower = false;
|
private boolean validPotionPower = false;
|
||||||
|
private boolean isSplashPotion = false;
|
||||||
private boolean completePotion = false;
|
private boolean completePotion = false;
|
||||||
private int power = 1;
|
private int power = 1;
|
||||||
private int duration = 120;
|
private int duration = 120;
|
||||||
@ -85,6 +87,7 @@ public class MetaItemStack {
|
|||||||
validPotionEffect = false;
|
validPotionEffect = false;
|
||||||
validPotionDuration = false;
|
validPotionDuration = false;
|
||||||
validPotionPower = false;
|
validPotionPower = false;
|
||||||
|
isSplashPotion = false;
|
||||||
completePotion = true;
|
completePotion = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,6 +336,8 @@ public class MetaItemStack {
|
|||||||
} else {
|
} else {
|
||||||
throw new Exception(tl("invalidPotionMeta", split[1]));
|
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()) {
|
if (isValidPotion()) {
|
||||||
@ -343,6 +348,9 @@ public class MetaItemStack {
|
|||||||
}
|
}
|
||||||
pmeta.addCustomEffect(pEffect, true);
|
pmeta.addCustomEffect(pEffect, true);
|
||||||
stack.setItemMeta(pmeta);
|
stack.setItemMeta(pmeta);
|
||||||
|
Potion potion = Potion.fromItemStack(stack);
|
||||||
|
potion.setSplash(isSplashPotion);
|
||||||
|
potion.apply(stack);
|
||||||
resetPotionMeta();
|
resetPotionMeta();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user