Bukkit/CraftBukkit — pull request #915 by turt2live (2012-11-04 21:18:43+00:00)
Title: Added EntityPotionEffectChangeEvent

Long name, I know. This PR (and the associated Bukkit PR) is likely not going to get pulled, I'm aware of that.

I kinda meant for this PR to show what kinds of things are to be expected of an event like this.

Associated Bukkit Pull Request: https://github.com/Bukkit/Bukkit/pull/706
Main ticket: https://bukkit.atlassian.net/browse/BUKKIT-2817
Plugin code used to test: http://pastebin.com/SU5Yujak
Original CraftBukkit Pull Request: https://github.com/Bukkit/CraftBukkit/pull/912

USE CASE:
For me personally, I would like a way to stop certain players from gaining beacon effects, and after much research (well, not really...) it was found they were just potion effects.

This new event allows plugin authors to better control what potion effects players (and maybe entities, if this were to be expanded) can, and cannot, have.

Although it is noted that you are unable to cancel a loss of an effect, this is described in the commit as "You cannot stop time".

Suggestions are welcome, I will do as much as I can to help ensure this (or something like it) ends up in Bukkit so I can continue my plugin easily.

(PS: I'm sure a lot of other developers would love this event as well, like WorldGuard, and region plugin, permissions plugins, etc, etc...)

EDITS:
- Renamed event from PlayerPotionEffectChangeEvent (player event) to EntityPotionEffectChangeEvent (entity event)
- Added ambient flag
- Added (true) duration and amplifier access
- getLocation() = The location of the event.
- Added firings for mobs (wither-like mobs, witches, zombies, etc) [MISSING CAVE SPIDER]