I'm developing a Minecraft server which incorporates realism using a command block network in the center of the map. I'm trying to simulate food spoiling via testing for the age of an item (i.e. if a bread item is left in a chest for 5 ingame days then it becomes spoiled). If a player eats such a food, then they will receive the poison effect. Is it possible to do this via commands (without plugins, of course)?
NB: One drawback of this is that foodstuffs are stackable, causing each individual item to lose their age property when combined with others. Asked a question regarding this