From b6e220e9f29d0ea384df16beb7d96c6e2fea8c93 Mon Sep 17 00:00:00 2001 From: k0rd Date: Mon, 6 Feb 2012 20:17:39 -0500 Subject: [PATCH] A player should be teleported to remembered position after he is finished being harassed to login. --- TShockAPI/Commands.cs | 12 +++++++++++- TShockAPI/TSPlayer.cs | 15 ++++++++++----- TShockAPI/TShock.cs | 4 +++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index 3feb0311..918dc316 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -407,8 +407,18 @@ namespace TShockAPI TShock.InventoryDB.InsertPlayerData(args.Player); } args.Player.SendMessage("Authenticated as " + user.Name + " successfully.", Color.LimeGreen); + Log.ConsoleInfo(args.Player.Name + " authenticated successfully as user: " + user.Name); - } + if ((args.Player.LoginHarassed) && (TShock.Config.RememberLeavePos)){ + if (TShock.RememberedPos.GetLeavePos(args.Player.Name, args.Player.IP) != Vector2.Zero) + { + Vector2 pos = TShock.RememberedPos.GetLeavePos(args.Player.Name, args.Player.IP); + + args.Player.Teleport((int) pos.X, (int) pos.Y + 3); + } + args.Player.LoginHarassed = false; + + }} else { args.Player.SendMessage("Incorrect password", Color.LimeGreen); diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 441543c5..0dd7ff1f 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -76,12 +76,12 @@ namespace TShockAPI public bool RequiresPassword; public bool SilentKickInProgress; public List IceTiles; - public long RPm=1; - public long WPm=1; - public long SPm=1; - public long BPm=1; + public long RPm = 1; + public long WPm = 1; + public long SPm = 1; + public long BPm = 1; public long LoginMS; - + public bool LoginHarassed = false; public bool RealPlayer { get { return Index >= 0 && Index < Main.maxNetPlayers && Main.player[Index] != null; } @@ -257,6 +257,10 @@ namespace TShockAPI //The error occurs when a tile trys to update which the client hasnt load yet, Clients only update tiles withen 150 blocks //Try 300 if it does not work (Higher number - Longer load times - Less chance of error) //Should we properly send sections so that clients don't get tiles twice? + SendTileSquare(tilex, tiley, 150); + +/* //We shouldn't need this section anymore -it can prevent otherwise acceptable teleportation under some circumstances. + if (!SendTileSquare(tilex, tiley, 150)) { InitSpawn = true; @@ -264,6 +268,7 @@ namespace TShockAPI return false; } +*/ Spawn(-1, -1); SendWorldInfo(Main.spawnTileX, Main.spawnTileY, false); diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 6c8e8054..dc527da0 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -686,7 +686,7 @@ namespace TShockAPI InventoryDB.InsertPlayerData(tsplr); } - if (Config.RememberLeavePos) + if ((Config.RememberLeavePos) &&(!tsplr.LoginHarassed)) { RememberedPos.InsertLeavePos(tsplr.Name, tsplr.IP, (int) (tsplr.X/16), (int) (tsplr.Y/16)); } @@ -860,10 +860,12 @@ namespace TShockAPI player.SendMessage( player.IgnoreActionsForInventory = "Server Side Inventory is enabled! Please /register or /login to play!", Color.Red); + player.LoginHarassed = true; } else if (Config.RequireLogin) { player.SendMessage("Please /register or /login to play!", Color.Red); + player.LoginHarassed = true; } }