Added the Client property.
The `Client` property gets data from the array `Terraria.Netplay.Clients`.
This commit is contained in:
parent
6d4682ed7e
commit
c047b0e87d
1 changed files with 12 additions and 7 deletions
|
|
@ -988,7 +988,7 @@ namespace TShockAPI
|
|||
get
|
||||
{
|
||||
return RealPlayer
|
||||
&& (Netplay.Clients[Index] != null && Netplay.Clients[Index].IsActive && !Netplay.Clients[Index].PendingTermination);
|
||||
&& (Client != null && Client.IsActive && !Client.PendingTermination);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1005,8 +1005,8 @@ namespace TShockAPI
|
|||
/// </summary>
|
||||
public int State
|
||||
{
|
||||
get { return Netplay.Clients[Index].State; }
|
||||
set { Netplay.Clients[Index].State = value; }
|
||||
get { return Client.State; }
|
||||
set { Client.State = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1014,7 +1014,7 @@ namespace TShockAPI
|
|||
/// </summary>
|
||||
public string UUID
|
||||
{
|
||||
get { return RealPlayer ? Netplay.Clients[Index].ClientUUID : ""; }
|
||||
get { return RealPlayer ? Client.ClientUUID : ""; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1026,8 +1026,8 @@ namespace TShockAPI
|
|||
{
|
||||
if (string.IsNullOrEmpty(CacheIP))
|
||||
return
|
||||
CacheIP = RealPlayer ? (Netplay.Clients[Index].Socket.IsConnected()
|
||||
? TShock.Utils.GetRealIP(Netplay.Clients[Index].Socket.GetRemoteAddress().ToString())
|
||||
CacheIP = RealPlayer ? (Client.Socket.IsConnected()
|
||||
? TShock.Utils.GetRealIP(Client.Socket.GetRemoteAddress().ToString())
|
||||
: "")
|
||||
: "127.0.0.1";
|
||||
else
|
||||
|
|
@ -1110,6 +1110,11 @@ namespace TShockAPI
|
|||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Player RemoteClient.
|
||||
/// </summary>
|
||||
public RemoteClient Client => Netplay.Clients[Index];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Terraria Player object associated with the player.
|
||||
/// </summary>
|
||||
|
|
@ -2071,7 +2076,7 @@ namespace TShockAPI
|
|||
if (!RealPlayer || !ConnectionAlive)
|
||||
return;
|
||||
|
||||
Netplay.Clients[Index].Socket.AsyncSend(data, 0, data.Length, Netplay.Clients[Index].ServerWriteCallBack);
|
||||
Client.Socket.AsyncSend(data, 0, data.Length, Client.ServerWriteCallBack);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue