Move Region related code into a separate subsystem
This commit is contained in:
parent
8d45222af3
commit
ec78a070a7
5 changed files with 201 additions and 93 deletions
|
|
@ -136,6 +136,11 @@ namespace TShockAPI
|
|||
/// <summary>The TShock anti-cheat/anti-exploit system.</summary>
|
||||
internal Bouncer Bouncer;
|
||||
|
||||
/// <summary>
|
||||
/// TShock's Region subsystem.
|
||||
/// </summary>
|
||||
internal RegionHandler RegionSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Called after TShock is initialized. Useful for plugins that needs hooks before tshock but also depend on tshock being loaded.
|
||||
/// </summary>
|
||||
|
|
@ -321,6 +326,7 @@ namespace TShockAPI
|
|||
RestManager = new RestManager(RestApi);
|
||||
RestManager.RegisterRestfulCommands();
|
||||
Bouncer = new Bouncer();
|
||||
RegionSystem = new RegionHandler(this, DB);
|
||||
|
||||
var geoippath = "GeoIP.dat";
|
||||
if (Config.EnableGeoIP && File.Exists(geoippath))
|
||||
|
|
@ -1144,22 +1150,6 @@ namespace TShockAPI
|
|||
player.SendErrorMessage($"You are holding a banned item: {player.TPlayer.inventory[player.TPlayer.selectedItem].Name}");
|
||||
}
|
||||
}
|
||||
|
||||
var oldRegion = player.CurrentRegion;
|
||||
player.CurrentRegion = Regions.GetTopRegion(Regions.InAreaRegion(player.TileX, player.TileY));
|
||||
|
||||
if (oldRegion != player.CurrentRegion)
|
||||
{
|
||||
if (oldRegion != null)
|
||||
{
|
||||
RegionHooks.OnRegionLeft(player, oldRegion);
|
||||
}
|
||||
|
||||
if (player.CurrentRegion != null)
|
||||
{
|
||||
RegionHooks.OnRegionEntered(player, player.CurrentRegion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Utils.SetConsoleTitle(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue