summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-03-01 08:30:03 +1100
committermd_5 <git@md-5.net>2016-03-01 08:30:03 +1100
commit02797db500dcaf3a9c97aa70f82ed5100d386a45 (patch)
tree11c6d8d0cc1493f08d841e7408fe71970a3eaf76 /src
parent33fbc3d8622d6a0804aeb0a5ff69295d21e95a82 (diff)
downloadbukkit-02797db500dcaf3a9c97aa70f82ed5100d386a45.tar
bukkit-02797db500dcaf3a9c97aa70f82ed5100d386a45.tar.gz
bukkit-02797db500dcaf3a9c97aa70f82ed5100d386a45.tar.lz
bukkit-02797db500dcaf3a9c97aa70f82ed5100d386a45.tar.xz
bukkit-02797db500dcaf3a9c97aa70f82ed5100d386a45.zip
SPIGOT-1357: Add potion particle effect color getters to API.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/potion/PotionEffect.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java
index 75bfa27a..6d25e673 100644
--- a/src/main/java/org/bukkit/potion/PotionEffect.java
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java
@@ -4,6 +4,7 @@ import java.util.Map;
import java.util.NoSuchElementException;
import org.apache.commons.lang.Validate;
+import org.bukkit.Color;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.SerializableAs;
import org.bukkit.entity.LivingEntity;
@@ -28,6 +29,7 @@ public class PotionEffect implements ConfigurationSerializable {
private final PotionEffectType type;
private final boolean ambient;
private final boolean particles;
+ private final Color color;
/**
* Creates a potion effect.
@@ -37,14 +39,30 @@ public class PotionEffect implements ConfigurationSerializable {
* @param amplifier the amplifier, see {@link PotionEffect#getAmplifier()}
* @param ambient the ambient status, see {@link PotionEffect#isAmbient()}
* @param particles the particle status, see {@link PotionEffect#hasParticles()}
+ * @param color the particle color, see {@link PotionEffect#getColor()}
*/
- public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles){
+ public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, Color color){
Validate.notNull(type, "effect type cannot be null");
this.type = type;
this.duration = duration;
this.amplifier = amplifier;
this.ambient = ambient;
this.particles = particles;
+ this.color = color;
+ }
+
+ /**
+ * Creates a potion effect with no defined color.
+ *
+ * @param type effect type
+ * @param duration measured in ticks, see {@link
+ * PotionEffect#getDuration()}
+ * @param amplifier the amplifier, see {@link PotionEffect#getAmplifier()}
+ * @param ambient the ambient status, see {@link PotionEffect#isAmbient()}
+ * @param particles the particle status, see {@link PotionEffect#hasParticles()}
+ */
+ public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles) {
+ this(type, duration, amplifier, ambient, true, null);
}
/**
@@ -186,6 +204,13 @@ public class PotionEffect implements ConfigurationSerializable {
return particles;
}
+ /**
+ * @return color of this potion's particles. May be null if the potion has no particles or defined color.
+ */
+ public Color getColor() {
+ return color;
+ }
+
@Override
public int hashCode() {
int hash = 1;