Add the region a player left to OnRegionLeft

This commit is contained in:
Lucas Nicodemus 2015-03-06 22:40:32 -07:00
parent fd2a049ef3
commit adc0f0acfb
2 changed files with 6 additions and 4 deletions

View file

@ -47,23 +47,25 @@ namespace TShockAPI.Hooks
public class RegionLeftEventArgs public class RegionLeftEventArgs
{ {
public TSPlayer Player { get; private set; } public TSPlayer Player { get; private set; }
public Region Region { get; private set; }
public RegionLeftEventArgs(TSPlayer ply) public RegionLeftEventArgs(TSPlayer ply, Region region)
{ {
Player = ply; Player = ply;
Region = region;
} }
} }
public delegate void RegionLeftD(RegionLeftEventArgs args); public delegate void RegionLeftD(RegionLeftEventArgs args);
public static event RegionLeftD RegionLeft; public static event RegionLeftD RegionLeft;
public static void OnRegionLeft(TSPlayer player) public static void OnRegionLeft(TSPlayer player, Region region)
{ {
if (RegionLeft == null) if (RegionLeft == null)
{ {
return; return;
} }
RegionLeft(new RegionLeftEventArgs(player)); RegionLeft(new RegionLeftEventArgs(player, region));
} }
public class RegionCreatedEventArgs public class RegionCreatedEventArgs

View file

@ -826,7 +826,7 @@ namespace TShockAPI
{ {
if (oldRegion != null) if (oldRegion != null)
{ {
Hooks.RegionHooks.OnRegionLeft(player); Hooks.RegionHooks.OnRegionLeft(player, oldRegion);
} }
if (player.CurrentRegion != null) if (player.CurrentRegion != null)