Added null check to banned item check.
This commit is contained in:
parent
c9cd8cb971
commit
e465caa230
2 changed files with 6 additions and 5 deletions
|
|
@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("2.3.0.0625")]
|
[assembly: AssemblyVersion("2.3.0.0627")]
|
||||||
[assembly: AssemblyFileVersion("2.3.0.0625")]
|
[assembly: AssemblyFileVersion("2.3.0.0627")]
|
||||||
|
|
@ -220,11 +220,12 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (!player.Group.HasPermission("usebanneditem"))
|
if (!player.Group.HasPermission("usebanneditem"))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Main.player[player.Index].inventory.Length; i++)
|
var inv = Main.player[player.Index].inventory;
|
||||||
|
for (int i = 0; i < inv.Length; i++)
|
||||||
{
|
{
|
||||||
if (ItemManager.ItemIsBanned(Main.player[player.Index].inventory[i].name))
|
if (inv[i] != null && ItemManager.ItemIsBanned(inv[i].name))
|
||||||
{
|
{
|
||||||
player.Disconnect("Using banned item: " + Main.player[player.Index].inventory[i].name + ", remove it and rejoin");
|
player.Disconnect("Using banned item: " + inv[i].name + ", remove it and rejoin");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue