Merge pull request #357 from k0rd/teleport-devel
Remember Position System: Teleport player to remembered position after successfully logging in (when forced to)
This commit is contained in:
commit
db3b928373
3 changed files with 24 additions and 7 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -76,12 +76,12 @@ namespace TShockAPI
|
|||
public bool RequiresPassword;
|
||||
public bool SilentKickInProgress;
|
||||
public List<Point> 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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue