Added null reference check when unbanning a player name and EnableBanOnUsernames is set to false. Few grammar related fixes related to unbanning.
This commit is contained in:
parent
5ec03c8e08
commit
2eeabb4c2f
1 changed files with 8 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
TShock, a server mod for Terraria
|
TShock, a server mod for Terraria
|
||||||
Copyright (C) 2011 The TShock Team
|
Copyright (C) 2011 The TShock Team
|
||||||
|
|
||||||
|
|
@ -704,15 +704,18 @@ namespace TShockAPI
|
||||||
if (TShock.Bans.RemoveBan(ban.IP))
|
if (TShock.Bans.RemoveBan(ban.IP))
|
||||||
args.Player.SendMessage(string.Format("Unbanned {0} ({1})!", ban.Name, ban.IP), Color.Red);
|
args.Player.SendMessage(string.Format("Unbanned {0} ({1})!", ban.Name, ban.IP), Color.Red);
|
||||||
else
|
else
|
||||||
args.Player.SendMessage(string.Format("Failed to Unbanned {0} ({1})!", ban.Name, ban.IP), Color.Red);
|
args.Player.SendMessage(string.Format("Failed to unban {0} ({1})!", ban.Name, ban.IP), Color.Red);
|
||||||
}
|
}
|
||||||
else if (!TShock.Config.EnableBanOnUsernames)
|
else if (!TShock.Config.EnableBanOnUsernames)
|
||||||
{
|
{
|
||||||
ban = TShock.Bans.GetBanByIp(plStr);
|
ban = TShock.Bans.GetBanByIp(plStr);
|
||||||
if (TShock.Bans.RemoveBan(ban.IP))
|
|
||||||
|
if (ban == null)
|
||||||
|
args.Player.SendMessage(string.Format("Failed to unban {0}, not found.", args.Parameters[0]), Color.Red);
|
||||||
|
else if (TShock.Bans.RemoveBan(ban.IP))
|
||||||
args.Player.SendMessage(string.Format("Unbanned {0} ({1})!", ban.Name, ban.IP), Color.Red);
|
args.Player.SendMessage(string.Format("Unbanned {0} ({1})!", ban.Name, ban.IP), Color.Red);
|
||||||
else
|
else
|
||||||
args.Player.SendMessage(string.Format("Failed to Unbanned {0} ({1})!", ban.Name, ban.IP), Color.Red);
|
args.Player.SendMessage(string.Format("Failed to unban {0} ({1})!", ban.Name, ban.IP), Color.Red);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -781,7 +784,7 @@ namespace TShockAPI
|
||||||
if (TShock.Bans.RemoveBan(ban.IP))
|
if (TShock.Bans.RemoveBan(ban.IP))
|
||||||
args.Player.SendMessage(string.Format("Unbanned {0} ({1})!", ban.Name, ban.IP), Color.Red);
|
args.Player.SendMessage(string.Format("Unbanned {0} ({1})!", ban.Name, ban.IP), Color.Red);
|
||||||
else
|
else
|
||||||
args.Player.SendMessage(string.Format("Failed to Unbanned {0} ({1})!", ban.Name, ban.IP), Color.Red);
|
args.Player.SendMessage(string.Format("Failed to unban {0} ({1})!", ban.Name, ban.IP), Color.Red);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue