SPIGOT-1638 / SPIGOT-1673: Rework Potions API
By: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
@@ -1,16 +1,31 @@
|
||||
package org.bukkit.inventory.meta;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a potion ({@link Material#POTION}) that can have custom effects.
|
||||
* Represents a potion or item that can have custom effects.
|
||||
*/
|
||||
public interface PotionMeta extends ItemMeta {
|
||||
|
||||
/**
|
||||
* Sets the underlying potion data
|
||||
*
|
||||
* @param data PotionData to set the base potion state to
|
||||
*/
|
||||
void setBasePotionData(PotionData data);
|
||||
|
||||
/**
|
||||
* Returns the potion data about the base potion
|
||||
*
|
||||
* @return a PotionData object
|
||||
*/
|
||||
PotionData getBasePotionData();
|
||||
|
||||
/**
|
||||
* Checks for the presence of custom potion effects.
|
||||
*
|
||||
@@ -22,8 +37,8 @@ public interface PotionMeta extends ItemMeta {
|
||||
* Gets an immutable list containing all custom potion effects applied to
|
||||
* this potion.
|
||||
* <p>
|
||||
* Plugins should check that hasCustomEffects() returns true before
|
||||
* calling this method.
|
||||
* Plugins should check that hasCustomEffects() returns true before calling
|
||||
* this method.
|
||||
*
|
||||
* @return the immutable list of custom potion effects
|
||||
*/
|
||||
@@ -34,7 +49,7 @@ public interface PotionMeta extends ItemMeta {
|
||||
*
|
||||
* @param effect the potion effect to add
|
||||
* @param overwrite true if any existing effect of the same type should be
|
||||
* overwritten
|
||||
* overwritten
|
||||
* @return true if the potion meta changed as a result of this call
|
||||
*/
|
||||
boolean addCustomEffect(PotionEffect effect, boolean overwrite);
|
||||
@@ -49,7 +64,7 @@ public interface PotionMeta extends ItemMeta {
|
||||
|
||||
/**
|
||||
* Checks for a specific custom potion effect type on this potion.
|
||||
*
|
||||
*
|
||||
* @param type the potion effect type to check for
|
||||
* @return true if the potion has this effect
|
||||
*/
|
||||
@@ -58,12 +73,13 @@ public interface PotionMeta extends ItemMeta {
|
||||
/**
|
||||
* Moves a potion effect to the top of the potion effect list.
|
||||
* <p>
|
||||
* This causes the client to display the potion effect in the potion's
|
||||
* name.
|
||||
* This causes the client to display the potion effect in the potion's name.
|
||||
*
|
||||
* @param type the potion effect type to move
|
||||
* @return true if the potion meta changed as a result of this call
|
||||
* @deprecated use {@link #setType(PotionType)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean setMainEffect(PotionEffectType type);
|
||||
|
||||
/**
|
||||
@@ -73,5 +89,6 @@ public interface PotionMeta extends ItemMeta {
|
||||
*/
|
||||
boolean clearCustomEffects();
|
||||
|
||||
@Override
|
||||
PotionMeta clone();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user