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:
Zack Piispanen 2012-02-04 16:39:36 -05:00
parent 54e822fb34
commit 46a653da99
4 changed files with 14 additions and 6 deletions

View file

@ -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;

View file

@ -57,6 +57,11 @@ namespace TShockAPI
/// </summary> /// </summary>
public class TileEditEventArgs : HandledEventArgs public class TileEditEventArgs : HandledEventArgs
{ {
/// <summary>
/// The TSPlayer who made the tile edit
/// </summary>
public TSPlayer Player { get; set; }
/// <summary> /// <summary>
/// The tile coordinate on the X plane /// The tile coordinate on the X plane
/// </summary> /// </summary>
@ -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;

View file

@ -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)
{ {

View file

@ -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.