EmilHernvall/tregmine — pull request #228 by lDiverse (2013-12-15 10:05:33+00:00)
Title: Custom Events

So with the inventory system I recently created, I needed a way to check every time a player changes lot/zone if their inventory needs to be changed. Now I could've been normal and done some checks on a player move in a listener and gotten away with it. but I'm not normal. So I made some custom events.

These custom events when used like normal will be triggered when a player zone/lot is respectively changed by a player. It returns the player (using TregminePlayer) the previous and new lot/zone and the previous/new location of the player as if you were using a playerMoveEvent.

I tested this system using this little bit of code:
```
@EventHandler
public void onCustomEvent(PlayerLotChangeEvent event)
{
event.getPlayer().sendMessage("CustomEventTriggered");
}
```
It worked perfectly, Broadcasting the message once when leaving a lot, joining a lot or moving from one lot to another.

The same with the zone one.

This is all pretty simple stuff and I hope we can continue to expand these custom events when needed.

;D