I know nothing about coding and I can still tell you that you are absolutely wrong. Every single item, every stack, every chest would have to be logged, and then checked every time someone tries to withdraw an item. It would cause substantial lag.
I have been the victim of this twice, and still think it is a bad idea. People are still going to completely wipe chests, whether something like this is in or not. It will not accomplish anything.
The system would not track every single item; just the stack size, type, and if the chest it was in belongs to the person who is taking it (for a server this is nothing, I AM a programmer (I also do web design)).
To be more specific (but still in laymen terms), this is how it would work in the program:
1| User opens chest
-1a| System checks chest owner/perms from a log and then checks owners friend list, output to local variable.
(because this is not World of Warcraft it would only take a fraction of a second for a server to go through two small files with only a few thousand small entries total (a single "ok" server has at least 16 processor cores at 2.45 Ghz each (thousands of operations a second FYI)).
-1aa| If the user is not the owner or a friend prep item list and out put to a log what is in the chest.
-1b| User is owner or permitted, exit.
2|User takes item from chest, if the local variable is TRUE do the following, else exit
-2a check the chest and output what is in it to a secondary log and do math from the two logs to get the change. (There is a better way to do this, but meh)
-2b send custom status effect to local machine and track the time out, update distance every three seconds.
That is a very basic and rough example and all of that would take 0.0001th of a second for a server (if that, because the servers herocraft is on are actually really powerful).