Bans will clear if you delete bans.txt
This commit is contained in:
parent
7e8486527f
commit
b46866e0dd
1 changed files with 11 additions and 3 deletions
|
|
@ -81,10 +81,17 @@ namespace TShockAPI
|
||||||
/// Reloads the file if it was changed
|
/// Reloads the file if it was changed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void EnsureChanges()
|
public void EnsureChanges()
|
||||||
|
{
|
||||||
|
if (File.Exists(Path))
|
||||||
{
|
{
|
||||||
if (new FileInfo(Path).LastWriteTime > LastLoad)
|
if (new FileInfo(Path).LastWriteTime > LastLoad)
|
||||||
LoadBans();
|
LoadBans();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Bans.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes | from the string
|
/// Removes | from the string
|
||||||
|
|
@ -98,10 +105,11 @@ namespace TShockAPI
|
||||||
|
|
||||||
public void LoadBans()
|
public void LoadBans()
|
||||||
{
|
{
|
||||||
|
Bans.Clear();
|
||||||
|
|
||||||
if (!File.Exists(Path))
|
if (!File.Exists(Path))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Bans.Clear();
|
|
||||||
LastLoad = new FileInfo(Path).LastWriteTime;
|
LastLoad = new FileInfo(Path).LastWriteTime;
|
||||||
|
|
||||||
foreach (var line in File.ReadAllLines(Path))
|
foreach (var line in File.ReadAllLines(Path))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue