blob: b19539935ddd8c2c2d69c4a2e6a7b281947b7651 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package org.bukkit.craftbukkit.entity;
import java.util.Collection;
import net.minecraft.server.EntityPotion;
import net.minecraft.server.MobEffect;
import net.minecraft.server.PotionUtil;
import org.apache.commons.lang.Validate;
import org.bukkit.Material;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import com.google.common.collect.ImmutableList;
public abstract class CraftThrownPotion extends CraftProjectile implements ThrownPotion {
public CraftThrownPotion(CraftServer server, EntityPotion entity) {
super(server, entity);
}
public Collection<PotionEffect> getEffects() {
ImmutableList.Builder<PotionEffect> builder = ImmutableList.builder();
for (MobEffect effect : PotionUtil.getEffects(getHandle().getItem())) {
builder.add(CraftPotionUtil.toBukkit(effect));
}
return builder.build();
}
public ItemStack getItem() {
return CraftItemStack.asBukkitCopy(getHandle().getItem());
}
@Override
public EntityPotion getHandle() {
return (EntityPotion) entity;
}
}
|