001 package org.bukkit.inventory.meta; 002 003 import org.bukkit.Material; 004 import org.bukkit.potion.PotionEffect; 005 import org.bukkit.potion.PotionEffectType; 006 007 import java.util.List; 008 009 /** 010 * Represents a potion ({@link Material#POTION}) that can have custom effects. 011 */ 012 public interface PotionMeta extends ItemMeta { 013 014 /** 015 * Checks for the presence of custom potion effects. 016 * 017 * @return true if custom potion effects are applied 018 */ 019 boolean hasCustomEffects(); 020 021 /** 022 * Gets an immutable list containing all custom potion effects applied to 023 * this potion. 024 * <p> 025 * Plugins should check that hasCustomEffects() returns true before 026 * calling this method. 027 * 028 * @return the immutable list of custom potion effects 029 */ 030 List<PotionEffect> getCustomEffects(); 031 032 /** 033 * Adds a custom potion effect to this potion. 034 * 035 * @param effect the potion effect to add 036 * @param overwrite true if any existing effect of the same type should be 037 * overwritten 038 * @return true if the potion meta changed as a result of this call 039 */ 040 boolean addCustomEffect(PotionEffect effect, boolean overwrite); 041 042 /** 043 * Removes a custom potion effect from this potion. 044 * 045 * @param type the potion effect type to remove 046 * @return true if the potion meta changed as a result of this call 047 */ 048 boolean removeCustomEffect(PotionEffectType type); 049 050 /** 051 * Checks for a specific custom potion effect type on this potion. 052 * 053 * @param type the potion effect type to check for 054 * @return true if the potion has this effect 055 */ 056 boolean hasCustomEffect(PotionEffectType type); 057 058 /** 059 * Moves a potion effect to the top of the potion effect list. 060 * <p> 061 * This causes the client to display the potion effect in the potion's 062 * name. 063 * 064 * @param type the potion effect type to move 065 * @return true if the potion meta changed as a result of this call 066 */ 067 boolean setMainEffect(PotionEffectType type); 068 069 /** 070 * Removes all custom potion effects from this potion. 071 * 072 * @return true if the potion meta changed as a result of this call 073 */ 074 boolean clearCustomEffects(); 075 076 PotionMeta clone(); 077 }