[SPIGOT-1357] Add potion effect colors to the API Created: 19/Dec/15  Updated: 27/Apr/16  Resolved: 22/Dec/15

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor
Reporter: blablubbabc Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None


 Description   

Every potion effect type has a certain fixed color, which can for example be found in the minecraft wiki: http://minecraft.gamepedia.com/Data_values#Status_effects

It might be useful for plugins to know these colors.
For example a plugin might want to spawn a particle effect with the color of a certain potion effect, or color leather armor in the same color as some active potion effect, etc.

A good place for adding them to the API might be as Color attribute of PotionEffectType.



 Comments   
Comment by blablubbabc [ 27/Apr/16 ]

Sorry to comment on this so late, but the new constructor with the new color attribute (https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/02797db500dcaf3a9c97aa70f82ed5100d386a45) is never called anywhere yet, no? So currently PotionEffect#getColor() will always return null for PotionEffects created by the API itself.

I would have expected that the default effect colors get passed to this somewhere, for example when creating a PotionEffect from a PotionEffectType: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/potion/PotionEffectType.java?at=73090659cd1be68f81662ea6d7035d6336e54857#165

Or that PotionEffect would figure out its color itself if none is specified.

Edit:
I am currently maintaining a mapping for those colors (and potion effect data values) in a plugin to be able (among other things) to spawn the potion break effect with the correct color for a given effect, and I would have liked if that would be part of the API, so that I don't have to keep that updated myself for every minecraft update.
http://prnt.sc/axi3mz

Comment by md_5 [ 22/Dec/15 ]

Added to 1.9

Generated at Thu Mar 27 04:22:33 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.