[Bleeding] Added Potions API. Fixes BUKKIT-389

By: fullwall <fullwall@optusnet.com>
This commit is contained in:
Bukkit/Spigot
2012-01-09 14:39:06 +08:00
parent af8929507e
commit a66baab794
11 changed files with 891 additions and 1 deletions

View File

@@ -1,10 +1,13 @@
package org.bukkit.entity;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
/**
* Represents a living entity, such as a monster or player
@@ -225,4 +228,53 @@ public interface LivingEntity extends Entity {
* @return Killer player, or null if none found.
*/
public Player getKiller();
/**
* Adds the given {@link PotionEffect} to this entity.
* Only one potion effect can be present for a given {@link PotionEffectType}.
*
* @param effect PotionEffect to be added
* @return Whether the effect could be added
*/
public boolean addPotionEffect(PotionEffect effect);
/**
* Adds the given {@link PotionEffect} to this entity.
* Only one potion effect can be present for a given {@link PotionEffectType}.
*
* @param effect PotionEffect to be added
* @param force Whether conflicting effects should be removed
* @return Whether the effect could be added
*/
public boolean addPotionEffect(PotionEffect effect, boolean force);
/**
* Attempts to add all of the given {@link PotionEffect} to this entity.
*
* @param effects The effects to add
* @return Whether all of the effects could be added
*/
public boolean addPotionEffects(Collection<PotionEffect> effects);
/**
* Returns whether the entity already has an existing
* effect of the given {@link PotionEffectType} applied to it.
*
* @param type The potion type to check
*/
public boolean hasPotionEffect(PotionEffectType type);
/**
* Removes any effects present of the given {@link PotionEffectType}.
*
* @param type The potion type to remove
*/
public void removePotionEffect(PotionEffectType type);
/**
* Returns all currently active {@link PotionEffect}s on this entity.
*
* @return A collection of {@link PotionEffect}s
*/
public Collection<PotionEffect> getActivePotionEffects();
}