Merge pull request #332 from k0rd/general-devel
Prevents users from sneaking items onto server in their hands!
This commit is contained in:
commit
0358c36b2e
4 changed files with 37 additions and 33 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("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;
|
||||||
|
|
||||||
[Description("Disables clown bomb projectiles from spawning")] public bool DisableClownBombs;
|
[Description("Disables clown bomb projectiles from spawning")] public bool DisableClownBombs;
|
||||||
|
|
|
||||||
|
|
@ -2374,7 +2374,14 @@ namespace TShockAPI
|
||||||
args.Player.SendData(PacketTypes.ItemDrop, "", id);
|
args.Player.SendData(PacketTypes.ItemDrop, "", id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if ((TShock.Config.ServerSideInventory) && (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond - args.Player.LoginMS < TShock.Config.LogonDiscardThreshold))
|
||||||
|
{
|
||||||
|
//Player is probably trying to sneak items onto the server in their hands!!!
|
||||||
|
Log.ConsoleInfo(string.Format("Player {0} tried to sneak {1} onto the server!", args.Player.Name, item.name));
|
||||||
|
args.Player.SendData(PacketTypes.ItemDrop, "", id);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
if (TShock.CheckIgnores(args.Player))
|
if (TShock.CheckIgnores(args.Player))
|
||||||
{
|
{
|
||||||
args.Player.SendData(PacketTypes.ItemDrop, "", id);
|
args.Player.SendData(PacketTypes.ItemDrop, "", id);
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ namespace TShockAPI
|
||||||
public long WPm=1;
|
public long WPm=1;
|
||||||
public long SPm=1;
|
public long SPm=1;
|
||||||
public long BPm=1;
|
public long BPm=1;
|
||||||
|
public long LoginMS;
|
||||||
|
|
||||||
public bool RealPlayer
|
public bool RealPlayer
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ namespace TShockAPI
|
||||||
public class TShock : TerrariaPlugin
|
public class TShock : TerrariaPlugin
|
||||||
{
|
{
|
||||||
public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
|
public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
public static readonly string VersionCodename = "Pre-Release - Code Freeze";
|
public static readonly string VersionCodename = "1.1.2 was sudden";
|
||||||
|
|
||||||
public static string SavePath = "tshock";
|
public static string SavePath = "tshock";
|
||||||
|
|
||||||
|
|
@ -819,6 +819,7 @@ namespace TShockAPI
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
player.LoginMS= DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
|
||||||
|
|
||||||
Utils.ShowFileToUser(player, "motd.txt");
|
Utils.ShowFileToUser(player, "motd.txt");
|
||||||
|
|
||||||
|
|
@ -1154,8 +1155,7 @@ namespace TShockAPI
|
||||||
if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.SPm) > 2000){
|
if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.SPm) > 2000){
|
||||||
player.SendMessage("Spawn protected from changes.", Color.Red);
|
player.SendMessage("Spawn protected from changes.", Color.Red);
|
||||||
player.SPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
|
player.SPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
|
||||||
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1167,14 +1167,14 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
if (!player.Group.HasPermission(Permissions.canbuild))
|
if (!player.Group.HasPermission(Permissions.canbuild))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.BPm) > 2000){
|
if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.BPm) > 2000){
|
||||||
player.SendMessage("You do not have permission to build!", Color.Red);
|
player.SendMessage("You do not have permission to build!", Color.Red);
|
||||||
player.BPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
|
player.BPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player.Group.HasPermission(Permissions.editspawn) && !Regions.CanBuild(tileX, tileY, player) &&
|
if (!player.Group.HasPermission(Permissions.editspawn) && !Regions.CanBuild(tileX, tileY, player) &&
|
||||||
Regions.InArea(tileX, tileY))
|
Regions.InArea(tileX, tileY))
|
||||||
{
|
{
|
||||||
|
|
@ -1183,12 +1183,10 @@ namespace TShockAPI
|
||||||
if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.RPm) > 2000){
|
if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.RPm) > 2000){
|
||||||
player.SendMessage("Region protected from changes.", Color.Red);
|
player.SendMessage("Region protected from changes.", Color.Red);
|
||||||
player.RPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
|
player.RPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.DisableBuild)
|
if (Config.DisableBuild)
|
||||||
{
|
{
|
||||||
if (!player.Group.HasPermission(Permissions.editspawn))
|
if (!player.Group.HasPermission(Permissions.editspawn))
|
||||||
|
|
@ -1196,10 +1194,7 @@ namespace TShockAPI
|
||||||
if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.WPm) > 2000){
|
if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.WPm) > 2000){
|
||||||
player.SendMessage("World protected from changes.", Color.Red);
|
player.SendMessage("World protected from changes.", Color.Red);
|
||||||
player.WPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
|
player.WPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1214,7 +1209,7 @@ namespace TShockAPI
|
||||||
player.SendMessage("Spawn protected from changes.", Color.Red);
|
player.SendMessage("Spawn protected from changes.", Color.Red);
|
||||||
player.SPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
|
player.SPm=DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue