diff options
author | 0x277F <0x277F@gmail.com> | 2014-12-05 14:09:05 -0700 |
---|---|---|
committer | md_5 <git@md-5.net> | 2014-12-18 21:19:10 +1100 |
commit | 935e6dd9397adf33261df6fcfb442357c7b2fa0e (patch) | |
tree | b563d3730a23880cd9a88a053e7e0bba8cc2d7eb /src/main/java | |
parent | 0af5d198f5c72f5517f37a36a8ab2bdf2fe5418d (diff) | |
download | bukkit-935e6dd9397adf33261df6fcfb442357c7b2fa0e.tar bukkit-935e6dd9397adf33261df6fcfb442357c7b2fa0e.tar.gz bukkit-935e6dd9397adf33261df6fcfb442357c7b2fa0e.tar.lz bukkit-935e6dd9397adf33261df6fcfb442357c7b2fa0e.tar.xz bukkit-935e6dd9397adf33261df6fcfb442357c7b2fa0e.zip |
Add API to PotionEffect to determine whether particles are visible and displayed to the client. Fixes SPIGOT-125
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/potion/PotionEffect.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java index 24ee19de..01503f49 100644 --- a/src/main/java/org/bukkit/potion/PotionEffect.java +++ b/src/main/java/org/bukkit/potion/PotionEffect.java @@ -26,22 +26,37 @@ public class PotionEffect implements ConfigurationSerializable { private final int duration; private final PotionEffectType type; private final boolean ambient; + private final boolean particles; /** * Creates a potion effect. - * * @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) { + public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles){ Validate.notNull(type, "effect type cannot be null"); this.type = type; this.duration = duration; this.amplifier = amplifier; this.ambient = ambient; + this.particles = particles; + } + + /** + * Creates a potion effect. Assumes that particles are visible + * + * @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()} + */ + public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient) { + this(type, duration, amplifier, ambient, true); } /** @@ -162,6 +177,13 @@ public class PotionEffect implements ConfigurationSerializable { return ambient; } + /** + * @return whether this effect has particles or not + */ + public boolean hasParticles(){ + return particles; + } + @Override public int hashCode() { int hash = 1; |