Merge pull request #878 from NyxStudios/orn

Add the region a player left to OnRegionLeft
This commit is contained in:
Zack 2015-03-07 11:04:52 -05:00
commit cb34de11bd
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)