Allow admins to choose either or both IP or name bans to enforce
This commit is contained in:
parent
d091f5b52d
commit
b497183423
2 changed files with 14 additions and 1 deletions
|
|
@ -217,6 +217,12 @@ namespace TShockAPI
|
|||
[Description("Kicks users using a proxy as identified with the GeoIP database")]
|
||||
public bool KickProxyUsers = true;
|
||||
|
||||
[Description("Kicks banned users by their name")]
|
||||
public bool EnableNameBans = false;
|
||||
|
||||
[Description("Kicks banned users by their IP")]
|
||||
public bool EnableIPBans = true;
|
||||
|
||||
public static ConfigFile Read(string path)
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
|
|
|
|||
|
|
@ -516,7 +516,14 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
var ban = Bans.GetBanByIp(player.IP);
|
||||
var ipban = Bans.GetBanByIp(player.IP);
|
||||
var nameban = Bans.GetBanByName(player.Name);
|
||||
Ban ban = null;
|
||||
if (ipban != null && Config.EnableIPBans)
|
||||
ban = ipban;
|
||||
else if (nameban != null && Config.EnableIPBans)
|
||||
ban = nameban;
|
||||
|
||||
if (ban != null)
|
||||
{
|
||||
TShock.Utils.ForceKick(player, string.Format("You are banned: {0}", ban.Reason));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue