Bukkit/CraftBukkit — pull request #967 by turt2live (2012-12-23 05:35:02+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/717
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
Original CraftBukkit Pull Request (round 2): https://github.com/Bukkit/CraftBukkit/pull/915
Original CraftBukkit Pull Request (round 3): https://github.com/Bukkit/CraftBukkit/pull/926
Original CraftBukkit Pull Request (round 4): https://github.com/Bukkit/CraftBukkit/pull/930
Original CraftBukkit Pull Request (round 5): https://github.com/Bukkit/CraftBukkit/pull/931

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)
- Updated for 1.4.6