sigonasr2 698da2eb25 ->Fixed explosion damage to not scale infinitely bsaed on distance.
->Fixed explosion damage calculation.
->Modified Elite Zombie targeting algorithm to follow proper detection
rules like regular monsters.
->Fixed a bug that never moved an Elite Zombie's spawn when spawn
camping occurred.
->Fixed players from getting kicked from the server on death.
->Tipper Arrows properly display their custom effects when linked now.
->All custom items that used Luck of the Sea just for glowing purposes
now hide the enchantment.
->Enchantments on vials properly display now.
->Added CustomPotion class to handle random generation of vials.
->Added setItemTier(),isUpgradeShard(),getUpgradeShardTier(), and
setUpgradeShardTier() to API.
2016-08-22 22:20:18 -05:00

41 lines
1.1 KiB
Java

package sig.plugin.TwosideKeeper.HelperStructures;
import java.util.List;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.potion.PotionEffect;
public class CustomPotion extends CustomItem{
int max_amplifier;
int min_amplifier;
List<PotionEffect> effects;
public CustomPotion(ItemStack item,List<PotionEffect> effects, int min_amplifier, int max_amplifier) {
super(item);
this.min_amplifier=min_amplifier;
this.max_amplifier=max_amplifier;
this.effects=effects;
}
public ItemStack getItemStack(int amt) {
ItemStack temp = item.clone();
temp.setAmount(amt);
if (temp.getItemMeta() instanceof PotionMeta) {
PotionMeta pm = (PotionMeta)temp.getItemMeta();
for (int i=0;i<effects.size();i++) {
PotionEffect pe = effects.get(i);
pm.addCustomEffect(new PotionEffect(pe.getType(),pe.getDuration(),(int)((Math.random()*(max_amplifier-min_amplifier)))+min_amplifier),true);
}
temp.setItemMeta(pm);
}
return temp;
}
public ItemStack getItemStack() {
return this.getItemStack(1);
}
}