Commits

t00thpick1 authored and md_5 committed 73090659cd1
SPIGOT-1638 / SPIGOT-1673: Rework Potions API
No tags

src/main/java/org/bukkit/entity/AreaEffectCloud.java

Modified
1 1 package org.bukkit.entity;
2 2
3 3 import java.util.List;
4 4 import org.bukkit.Color;
5 -import org.bukkit.Effect;
6 5 import org.bukkit.Particle;
6 +import org.bukkit.potion.PotionData;
7 7 import org.bukkit.potion.PotionEffect;
8 +import org.bukkit.potion.PotionEffectType;
8 9
9 10 /**
10 11 * Represents an area effect cloud which will imbue a potion effect onto
11 12 * entities which enter it.
12 13 */
13 14 public interface AreaEffectCloud extends Entity {
14 15
15 16 /**
16 17 * Gets the duration which this cloud will exist for (in ticks).
17 18 *
64 65 */
65 66 int getDurationOnUse();
66 67
67 68 /**
68 69 * Sets the amount that the duration of this cloud will decrease by when it
69 70 * applies an effect to an entity.
70 71 *
71 72 * @param duration duration on use delta
72 73 */
73 74 void setDurationOnUse(int duration);
75 +
74 76 /**
75 77 * Gets the initial radius of the cloud.
76 78 *
77 79 * @return radius
78 80 */
79 81 float getRadius();
80 82
81 83 /**
82 84 * Sets the initial radius of the cloud.
83 85 *
123 125 Particle getParticle();
124 126
125 127 /**
126 128 * Sets the particle which this cloud will be composed of
127 129 *
128 130 * @param particle the new particle type
129 131 */
130 132 void setParticle(Particle particle);
131 133
132 134 /**
133 - * Get a copy of all effects which can be applied by this cloud. No
134 - * guarantees are made about the nature of the returned list.
135 + * Sets the underlying potion data
136 + *
137 + * @param data PotionData to set the base potion state to
138 + */
139 + void setBasePotionData(PotionData data);
140 +
141 + /**
142 + * Returns the potion data about the base potion
143 + *
144 + * @return a PotionData object
145 + */
146 + PotionData getBasePotionData();
147 +
148 + /**
149 + * Checks for the presence of custom potion effects.
150 + *
151 + * @return true if custom potion effects are applied
152 + */
153 + boolean hasCustomEffects();
154 +
155 + /**
156 + * Gets an immutable list containing all custom potion effects applied to
157 + * this cloud.
158 + * <p>
159 + * Plugins should check that hasCustomEffects() returns true before calling
160 + * this method.
135 161 *
136 - * @return the list of all effects
162 + * @return the immutable list of custom potion effects
137 163 */
138 - List<PotionEffect> getEffects();
164 + List<PotionEffect> getCustomEffects();
139 165
140 166 /**
141 - * Add an effect which can be applied by this cloud.
167 + * Adds a custom potion effect to this cloud.
142 168 *
143 - * @param effect the effect to add
169 + * @param effect the potion effect to add
170 + * @param overwrite true if any existing effect of the same type should be
171 + * overwritten
172 + * @return true if the effect was added as a result of this call
144 173 */
145 - void addEffect(PotionEffect effect);
174 + boolean addCustomEffect(PotionEffect effect, boolean overwrite);
146 175
147 176 /**
148 - * Remove an effect from this cloud.
177 + * Removes a custom potion effect from this cloud.
149 178 *
150 - * @param effect the effect to remove
179 + * @param type the potion effect type to remove
180 + * @return true if the an effect was removed as a result of this call
151 181 */
152 - void removeEffect(PotionEffect effect);
182 + boolean removeCustomEffect(PotionEffectType type);
153 183
154 184 /**
155 - * Set the effects of this cloud. Will remove all existing effects.
185 + * Checks for a specific custom potion effect type on this cloud.
156 186 *
157 - * @param effects the new effects to set
187 + * @param type the potion effect type to check for
188 + * @return true if the potion has this effect
189 + */
190 + boolean hasCustomEffect(PotionEffectType type);
191 +
192 + /**
193 + * Removes all custom potion effects from this cloud.
158 194 */
159 - void setEffects(List<PotionEffect> effects);
195 + void clearCustomEffects();
160 196
161 197 /**
162 198 * Gets the color of this cloud. Will be applied as a tint to its particles.
163 199 *
164 200 * @return cloud color
165 201 */
166 202 Color getColor();
167 203
168 204 /**
169 205 * Sets the color of this cloud. Will be applied as a tint to its particles.

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut