mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Fix /clones not including online player latest IPs
This commit is contained in:
parent
4df2aaf752
commit
96e8351a08
@ -40,6 +40,11 @@ namespace MCGalaxy.Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<string> accounts = PlayerInfo.FindAccounts(message);
|
List<string> accounts = PlayerInfo.FindAccounts(message);
|
||||||
|
// in older versions it was possible for your name to appear multiple times in DB
|
||||||
|
if (p != null) {
|
||||||
|
while (accounts.CaselessRemove(p.name)) { }
|
||||||
|
}
|
||||||
|
|
||||||
if (accounts.Count == 0) {
|
if (accounts.Count == 0) {
|
||||||
Player.Message(p, "No players last played with the given IP.");
|
Player.Message(p, "No players last played with the given IP.");
|
||||||
} else {
|
} else {
|
||||||
|
@ -107,6 +107,7 @@ namespace MCGalaxy {
|
|||||||
InitPlayerStats(playerDb);
|
InitPlayerStats(playerDb);
|
||||||
} else {
|
} else {
|
||||||
LoadPlayerStats(playerDb);
|
LoadPlayerStats(playerDb);
|
||||||
|
//save(); // update IP and total logins in the DB
|
||||||
}
|
}
|
||||||
|
|
||||||
Server.Background.QueueOnce(ShowAltsTask, name, TimeSpan.Zero);
|
Server.Background.QueueOnce(ShowAltsTask, name, TimeSpan.Zero);
|
||||||
@ -223,11 +224,8 @@ namespace MCGalaxy {
|
|||||||
if (p == null || p.ip == "127.0.0.1" || p.disconnected) return;
|
if (p == null || p.ip == "127.0.0.1" || p.disconnected) return;
|
||||||
|
|
||||||
List<string> alts = PlayerInfo.FindAccounts(p.ip);
|
List<string> alts = PlayerInfo.FindAccounts(p.ip);
|
||||||
// Remove online accounts from the list of accounts on the IP
|
// in older versions it was possible for your name to appear multiple times in DB
|
||||||
for (int i = alts.Count - 1; i >= 0; i--) {
|
while (alts.CaselessRemove(p.name)) { }
|
||||||
if (PlayerInfo.FindExact(alts[i]) == null) continue;
|
|
||||||
alts.RemoveAt(i);
|
|
||||||
}
|
|
||||||
if (alts.Count == 0) return;
|
if (alts.Count == 0) return;
|
||||||
|
|
||||||
LevelPermission adminChatRank = CommandOtherPerms.FindPerm("adminchat", LevelPermission.Admin);
|
LevelPermission adminChatRank = CommandOtherPerms.FindPerm("adminchat", LevelPermission.Admin);
|
||||||
|
@ -160,8 +160,8 @@ namespace MCGalaxy {
|
|||||||
return row == null ? null : row["Name"].ToString();
|
return row == null ? null : row["Name"].ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Retrieves from the database the names of all players whose
|
/// <summary> Retrieves names of all players whose IP address matches the given IP address. </summary>
|
||||||
/// last IP address matches the given IP address. </summary>
|
/// <remarks> This is current IP for online players, last IP for offline players from the database. </remarks>
|
||||||
public static List<string> FindAccounts(string ip) {
|
public static List<string> FindAccounts(string ip) {
|
||||||
DataTable clones = Database.Backend.GetRows("Players", "Name", "WHERE IP=@0", ip);
|
DataTable clones = Database.Backend.GetRows("Players", "Name", "WHERE IP=@0", ip);
|
||||||
List<string> alts = new List<string>();
|
List<string> alts = new List<string>();
|
||||||
@ -171,6 +171,14 @@ namespace MCGalaxy {
|
|||||||
if (!alts.CaselessContains(name))
|
if (!alts.CaselessContains(name))
|
||||||
alts.Add(name);
|
alts.Add(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player[] players = PlayerInfo.Online.Items;
|
||||||
|
foreach (Player p in players) {
|
||||||
|
if (p.ip != ip) continue;
|
||||||
|
if (!alts.CaselessContains(p.name))
|
||||||
|
alts.Add(p.name);
|
||||||
|
}
|
||||||
|
|
||||||
clones.Dispose();
|
clones.Dispose();
|
||||||
return alts;
|
return alts;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user