Skip to content
This repository was archived by the owner on Mar 8, 2025. It is now read-only.

Commit

Permalink
修复IP返回错误(白名单无法登录)
Browse files Browse the repository at this point in the history
  • Loading branch information
ACaiCat committed Dec 20, 2024
1 parent 3231486 commit 566e7ca
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions CaiBotMod/Common/TSPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,6 @@ protected TSPlayer(string playerName)
/// <summary>
/// The player's group.
/// </summary>
public Group Group
{
get
{
if (this.tempGroup != null)
{
return this.tempGroup;
}

return this.group;
}
set => this.group = value;
}

public bool ReceivedInfo { get; set; }

Expand Down Expand Up @@ -419,8 +406,7 @@ public bool GodMode
/// Checks if the player is active and not pending termination.
/// </summary>
public bool ConnectionAlive =>
this.RealPlayer
&& this.Client != null && this.Client.IsActive && !this.Client.PendingTermination;
this.RealPlayer && this.Client is { IsActive: true, PendingTermination: false };

/// <summary>
/// Gets the item that the player is currently holding.
Expand Down Expand Up @@ -448,7 +434,7 @@ public string IP
{
return this.CacheIP = (this.RealPlayer
? this.Client.Socket.IsConnected()
? this.Client.Socket.GetRemoteAddress().ToString()
? this.Client.Socket.GetRemoteAddress().ToString()!.Split(':')[0]
: ""
: "127.0.0.1")!;
}
Expand Down Expand Up @@ -1283,7 +1269,6 @@ public class TSRestPlayer : TSPlayer

public TSRestPlayer(string playerName, Group playerGroup) : base(playerName)
{
this.Group = playerGroup;
this.AwaitingResponse = new Dictionary<string, Action<object>>();
}

Expand Down

0 comments on commit 566e7ca

Please sign in to comment.