Started work on revamping command system for permissions, but I'm out for the night, cya tomorrow
This commit is contained in:
parent
3774c30f7d
commit
8344801128
6 changed files with 70 additions and 1 deletions
|
|
@ -373,6 +373,7 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
}
|
||||
groups.Add(group);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -405,6 +406,31 @@ namespace TShockAPI
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a Group for a ip from users.txt
|
||||
/// </summary>
|
||||
/// <param name="ply">string ip</param>
|
||||
public static Group GetGroupForIP(string ip)
|
||||
{
|
||||
ip = GetRealIP(ip);
|
||||
|
||||
StreamReader sr = new StreamReader("users.txt");
|
||||
string data = sr.ReadToEnd();
|
||||
data = data.Replace("\r", "");
|
||||
string[] lines = data.Split('\n');
|
||||
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
string[] args = lines[i].Split(' ');
|
||||
if (args[0].Equals(ip))
|
||||
{
|
||||
return GetGroup(args[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return GetGroup("default");
|
||||
}
|
||||
|
||||
public Tools() { }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue