Now that i read the actual full source code I see why it was lagging.

What might be a better idea is to only hook the objects themselves and then it will only trigger when an ent touches them and there is always less of them than players. So rather than what every player is touching and then if they are touching a banned item. It would be less cost to hook the restricted item instead. Likewise you could also try to only hook players who are actually restricted.

Second clients needs a validy check before being used in any arrays to ensure that it is indeed a valid client and not some random entity for example which would cause an arrayindex out of bounds error.

Another temp and faster solution may be to check if a user has a restrected item and then force them to drop it. You could run the check every 1 second or something or implement it as a delay after they get the item. For example the plugin already knows when a user gets an item and if that user is supposed to be restricted so if they were restrected you could start a 1 second timer to make the user drop the item. This would then allow an unrestricted user to pick it up.