Updated Local Files
This commit is contained in:
parent
87e3fd347d
commit
44afc6d8dd
3 changed files with 33 additions and 10 deletions
|
|
@ -1007,7 +1007,9 @@ namespace TShockAPI
|
||||||
//Added restart command
|
//Added restart command
|
||||||
private static void Restart(CommandArgs args)
|
private static void Restart(CommandArgs args)
|
||||||
{
|
{
|
||||||
|
if (Main.runningMono){
|
||||||
|
Log.ConsoleInfo("Sorry, this command has not yet been implemented in Mono");
|
||||||
|
}else{
|
||||||
if (TShock.Config.ServerSideInventory)
|
if (TShock.Config.ServerSideInventory)
|
||||||
{
|
{
|
||||||
foreach (TSPlayer player in TShock.Players)
|
foreach (TSPlayer player in TShock.Players)
|
||||||
|
|
@ -1024,7 +1026,7 @@ namespace TShockAPI
|
||||||
Netplay.disconnect = true;
|
Netplay.disconnect = true;
|
||||||
System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
|
System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}}
|
||||||
|
|
||||||
private static void OffNoSave(CommandArgs args)
|
private static void OffNoSave(CommandArgs args)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,28 @@ namespace TShockAPI.DB
|
||||||
creator.EnsureExists(table);
|
creator.EnsureExists(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector2 CheckLeavePos(string name)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var reader = database.QueryReader("SELECT * FROM RememberedPos WHERE Name=@0", name))
|
||||||
|
{
|
||||||
|
if (reader.Read())
|
||||||
|
{
|
||||||
|
return new Vector2(reader.Get<int>("X"), reader.Get<int>("Y"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Vector2();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Vector2 GetLeavePos(string name, string IP)
|
public Vector2 GetLeavePos(string name, string IP)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -66,12 +88,11 @@ namespace TShockAPI.DB
|
||||||
|
|
||||||
public void InsertLeavePos(string name, string IP, int X, int Y)
|
public void InsertLeavePos(string name, string IP, int X, int Y)
|
||||||
{
|
{
|
||||||
if (GetLeavePos(name, IP) == Vector2.Zero)
|
if (CheckLeavePos(name) == Vector2.Zero)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
database.Query("INSERT INTO RememberedPos (Name, IP, X, Y, WorldID) VALUES (@0, @1, @2, @3, @4);", name, IP, X,
|
database.Query("INSERT INTO RememberedPos (Name, IP, X, Y, WorldID) VALUES (@0, @1, @2, @3, @4);", name, IP, X, Y , Main.worldID.ToString());
|
||||||
Y + 3, Main.worldID.ToString());
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -82,8 +103,7 @@ namespace TShockAPI.DB
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
database.Query("UPDATE RememberedPos SET X = @0, Y = @1 WHERE Name = @2 AND IP = @3 AND WorldID = @4;", X, Y + 3,
|
database.Query("UPDATE RememberedPos SET X = @0, Y = @1, IP = @2 WHERE Name = @3 AND WorldID = @4;", X, Y, IP, name, Main.worldID.ToString());
|
||||||
name, IP, Main.worldID.ToString());
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -854,10 +854,11 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (Config.RememberLeavePos)
|
if (Config.RememberLeavePos)
|
||||||
{
|
{
|
||||||
|
if (RememberedPos.GetLeavePos(player.Name, player.IP) != Vector2.Zero){
|
||||||
var pos = RememberedPos.GetLeavePos(player.Name, player.IP);
|
var pos = RememberedPos.GetLeavePos(player.Name, player.IP);
|
||||||
player.LastNetPosition = pos;
|
player.LastNetPosition = pos;
|
||||||
player.Teleport((int) pos.X, (int) pos.Y + 3);
|
player.Teleport((int) pos.X, (int) pos.Y + 3);
|
||||||
}
|
}}
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue