Added config option for how often to save ssi, and applied that to the save checker.
Changed the OnTileEdit hook to take a player as well, so we know who is doing the edit. Changed the output of the Debug folder to go back to bin\Debug\ since I dont work 3 directories about TShock.
This commit is contained in:
parent
54e822fb34
commit
46a653da99
4 changed files with 14 additions and 6 deletions
|
|
@ -151,6 +151,8 @@ namespace TShockAPI
|
||||||
|
|
||||||
[Description("Enable Server Side Inventory checks, EXPERIMENTAL")] public bool ServerSideInventory;
|
[Description("Enable Server Side Inventory checks, EXPERIMENTAL")] public bool ServerSideInventory;
|
||||||
|
|
||||||
|
[Description("How often SSI should save, in minutes")] public int ServerSideInventorySave = 15;
|
||||||
|
|
||||||
[Description("Time, in milliseconds, to disallow discarding items after logging in when ServerSideInventory is ON")] public int LogonDiscardThreshold=250;
|
[Description("Time, in milliseconds, to disallow discarding items after logging in when ServerSideInventory is ON")] public int LogonDiscardThreshold=250;
|
||||||
|
|
||||||
[Description("Disables reporting of playercount to the stat system.")] public bool DisablePlayerCountReporting;
|
[Description("Disables reporting of playercount to the stat system.")] public bool DisablePlayerCountReporting;
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,11 @@ namespace TShockAPI
|
||||||
public class TileEditEventArgs : HandledEventArgs
|
public class TileEditEventArgs : HandledEventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// The TSPlayer who made the tile edit
|
||||||
|
/// </summary>
|
||||||
|
public TSPlayer Player { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
/// The tile coordinate on the X plane
|
/// The tile coordinate on the X plane
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int X { get; set; }
|
public int X { get; set; }
|
||||||
|
|
@ -82,13 +87,14 @@ namespace TShockAPI
|
||||||
/// TileEdit - called when a tile is placed or destroyed
|
/// TileEdit - called when a tile is placed or destroyed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static HandlerList<TileEditEventArgs> TileEdit;
|
public static HandlerList<TileEditEventArgs> TileEdit;
|
||||||
private static bool OnTileEdit(int x, int y, byte type, byte editType)
|
private static bool OnTileEdit(TSPlayer ply, int x, int y, byte type, byte editType)
|
||||||
{
|
{
|
||||||
if (TileEdit == null)
|
if (TileEdit == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var args = new TileEditEventArgs
|
var args = new TileEditEventArgs
|
||||||
{
|
{
|
||||||
|
Player = ply,
|
||||||
X = x,
|
X = x,
|
||||||
Y = y,
|
Y = y,
|
||||||
Type = type,
|
Type = type,
|
||||||
|
|
@ -1598,7 +1604,7 @@ namespace TShockAPI
|
||||||
var tileX = args.Data.ReadInt32();
|
var tileX = args.Data.ReadInt32();
|
||||||
var tileY = args.Data.ReadInt32();
|
var tileY = args.Data.ReadInt32();
|
||||||
var tiletype = args.Data.ReadInt8();
|
var tiletype = args.Data.ReadInt8();
|
||||||
if (OnTileEdit(tileX, tileY, tiletype, type))
|
if (OnTileEdit(args.Player, tileX, tileY, tiletype, type))
|
||||||
return true;
|
return true;
|
||||||
if (tileX < 0 || tileX >= Main.maxTilesX || tileY < 0 || tileY >= Main.maxTilesY)
|
if (tileX < 0 || tileX >= Main.maxTilesX || tileY < 0 || tileY >= Main.maxTilesY)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -446,7 +446,7 @@ namespace TShockAPI
|
||||||
LastCheck = DateTime.UtcNow;
|
LastCheck = DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((DateTime.UtcNow - LastSave).TotalMinutes >= 15)
|
if ((DateTime.UtcNow - LastSave).TotalMinutes >= Config.ServerSideInventorySave)
|
||||||
{
|
{
|
||||||
foreach (TSPlayer player in Players)
|
foreach (TSPlayer player in Players)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,12 @@
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>..\..\..\Tshock Debug\ServerPlugins\</OutputPath>
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<DocumentationFile>..\..\..\Tshock Debug\ServerPlugins\TShockAPI.XML</DocumentationFile>
|
<DocumentationFile>bin\Debug\TShockAPI.XML</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
|
|
@ -187,7 +187,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<VisualStudio>
|
<VisualStudio>
|
||||||
<UserProperties BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildAction="Both" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_StartDate="2011/6/17" BuildVersion_IncrementBeforeBuild="False" />
|
<UserProperties BuildVersion_IncrementBeforeBuild="False" BuildVersion_StartDate="2011/6/17" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_BuildAction="Both" BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" />
|
||||||
</VisualStudio>
|
</VisualStudio>
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue