Prevents users from sneaking items onto the server by holding them in their hands when ServerSideInventory is enabled.
This commit is contained in:
parent
1666c657d6
commit
b66358bef2
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);
|
||||||
|
|
|
||||||
|
|
@ -76,11 +76,11 @@ namespace TShockAPI
|
||||||
public bool RequiresPassword;
|
public bool RequiresPassword;
|
||||||
public bool SilentKickInProgress;
|
public bool SilentKickInProgress;
|
||||||
public List<Point> IceTiles;
|
public List<Point> IceTiles;
|
||||||
public long RPm=1;
|
public long RPm=1;
|
||||||
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");
|
||||||
|
|
||||||
|
|
@ -1153,10 +1154,9 @@ 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))
|
||||||
{
|
{
|
||||||
|
|
@ -1182,24 +1182,19 @@ 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))
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1210,11 +1205,11 @@ namespace TShockAPI
|
||||||
var flag = CheckSpawn(tileX, tileY);
|
var flag = CheckSpawn(tileX, tileY);
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.SPm) > 1000){
|
if (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - player.SPm) > 1000){
|
||||||
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