Add remaining backbone for banning accounts (sort of)

Frontend still doesn't work properly. In particular:

1. Need a way to list bans by account name.
2. Need a way to unban by account name.
3. Really need a way to change the IP on a ban lol.

Ban system still needs to be be rebuilt fully, but at least this
doesn't necessarily character ban someone if you were going for an IP
ban.

Fixes #1412
This commit is contained in:
Lucas Nicodemus 2017-12-02 20:41:14 -07:00
parent 0edfc6834f
commit 718525904a
5 changed files with 60 additions and 11 deletions

View file

@ -1367,7 +1367,7 @@ namespace TShockAPI
}
targetGeneralizedName = target.Name;
success = TShock.Bans.AddBan(target.IP, target.Name, target.UUID, banReason, false, args.Player.User.Name,
success = TShock.Bans.AddBan2(target.IP, target.Name, target.UUID, target.User.Name, banReason, false, args.Player.User.Name,
banLengthInSeconds == 0 ? "" : banLengthInSeconds.ToString());
// Since this is an online ban, we need to dc the player and tell them now.
@ -1397,7 +1397,7 @@ namespace TShockAPI
Regex r = new Regex(pattern, RegexOptions.IgnoreCase);
if (r.IsMatch(args.Parameters[1])) {
targetGeneralizedName = "IP: " + args.Parameters[1];
success = TShock.Bans.AddBan(args.Parameters[1], "", "", banReason,
success = TShock.Bans.AddBan2(args.Parameters[1], "", "", "", banReason,
false, args.Player.User.Name, banLengthInSeconds == 0 ? "" : banLengthInSeconds.ToString());
if (success && offlineUser != null)
{
@ -1445,8 +1445,8 @@ namespace TShockAPI
string lastIP = JsonConvert.DeserializeObject<List<string>>(offlineUser.KnownIps).Last();
success =
TShock.Bans.AddBan(lastIP,
offlineUser.Name, offlineUser.UUID, banReason, false, args.Player.User.Name,
TShock.Bans.AddBan2(lastIP,
"", offlineUser.UUID, offlineUser.Name, banReason, false, args.Player.User.Name,
banLengthInSeconds == 0 ? "" : banLengthInSeconds.ToString());
}