Moved unhandled exception logging to before saving the world. In case the world saving crashes.
Tidied some code. New day, new version
This commit is contained in:
parent
923aa66694
commit
dcf67248f7
4 changed files with 20 additions and 23 deletions
|
|
@ -165,12 +165,11 @@ namespace TShockAPI
|
|||
{
|
||||
return Tools.HandleGriefer(args.Player, "Sent client info more than once");
|
||||
}
|
||||
if (ConfigurationManager.HardcoreOnly)
|
||||
if (!hardcore)
|
||||
{
|
||||
Tools.ForceKick(args.Player, "Server is set to hardcore characters only!");
|
||||
return true;
|
||||
}
|
||||
if (ConfigurationManager.HardcoreOnly && !hardcore)
|
||||
{
|
||||
Tools.ForceKick(args.Player, "Server is set to hardcore characters only!");
|
||||
return true;
|
||||
}
|
||||
|
||||
args.Player.ReceivedInfo = true;
|
||||
return false;
|
||||
|
|
@ -295,13 +294,13 @@ namespace TShockAPI
|
|||
if (!args.Player.TilesDestroyed.ContainsKey(coords))
|
||||
args.Player.TilesDestroyed.Add(coords, Main.tile[x, y]);
|
||||
}
|
||||
if (args.Player.LastExplosive != null)
|
||||
if ((DateTime.UtcNow - args.Player.LastExplosive).TotalMilliseconds < 1000)
|
||||
{
|
||||
args.Player.SendMessage("Please wait another " + (1000 - (DateTime.UtcNow - args.Player.LastExplosive).TotalMilliseconds).ToString() + " milliseconds before placing/destroying tiles", Color.Red);
|
||||
args.Player.SendTileSquare(x, y);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((DateTime.UtcNow - args.Player.LastExplosive).TotalMilliseconds < 1000)
|
||||
{
|
||||
args.Player.SendMessage("Please wait another " + (1000 - (DateTime.UtcNow - args.Player.LastExplosive).TotalMilliseconds).ToString() + " milliseconds before placing/destroying tiles", Color.Red);
|
||||
args.Player.SendTileSquare(x, y);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
|
|||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
[assembly: AssemblyVersion("2.3.0.0627")]
|
||||
[assembly: AssemblyFileVersion("2.3.0.0627")]
|
||||
[assembly: AssemblyVersion("2.3.0.0628")]
|
||||
[assembly: AssemblyFileVersion("2.3.0.0628")]
|
||||
|
|
@ -71,9 +71,11 @@ namespace TShockAPI
|
|||
{
|
||||
foreach(Region region in Regions)
|
||||
{
|
||||
if (X >= region.RegionArea.Left && X <= region.RegionArea.Right && Y >= region.RegionArea.Top && Y <= region.RegionArea.Bottom && region.DisableBuild && Main.worldName == region.WorldRegionName && (!AllowedUser(region.RegionName, IP.ToLower()) || region.RegionAllowedIPs.Count == 0))
|
||||
if (X >= region.RegionArea.Left && X <= region.RegionArea.Right &&
|
||||
Y >= region.RegionArea.Top && Y <= region.RegionArea.Bottom &&
|
||||
region.DisableBuild && Main.worldName == region.WorldRegionName &&
|
||||
(!AllowedUser(region.RegionName, IP.ToLower()) || region.RegionAllowedIPs.Count == 0))
|
||||
{
|
||||
Console.WriteLine(region.RegionName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ namespace TShockAPI
|
|||
/// <param name="e"></param>
|
||||
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
Log.Error(e.ExceptionObject.ToString());
|
||||
if (e.IsTerminating)
|
||||
{
|
||||
if (Main.worldPathName != null)
|
||||
|
|
@ -147,7 +148,6 @@ namespace TShockAPI
|
|||
}
|
||||
DeInitialize();
|
||||
}
|
||||
Log.Error(e.ExceptionObject.ToString());
|
||||
}
|
||||
|
||||
private void HandleCommandLine(string[] parms)
|
||||
|
|
@ -537,11 +537,7 @@ namespace TShockAPI
|
|||
{
|
||||
Vector2 tile = new Vector2(x, y);
|
||||
Vector2 spawn = new Vector2(Main.spawnTileX, Main.spawnTileY);
|
||||
var distance = Vector2.Distance(spawn, tile);
|
||||
if (distance > ConfigurationManager.SpawnProtectRadius)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
return Vector2.Distance(spawn, tile) <= ConfigurationManager.SpawnProtectRadius;
|
||||
}
|
||||
|
||||
public static bool HackedHealth(TSPlayer player)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue