Closed venashial closed 3 years ago
Thanks for this in depth suggestion! I've been working on the mod for a while now with this on the back of my mind and in its current state, I don't think its necessary. If you want to protect your chest from being locked but still allow access you can just set it to public. In your explanation, a mischievous player could very easily just break the unlocked container and replace it.
It looks like this is still in progress, but I have an idea to make it more useful than other similar projects.
My suggestion:
Make chests only lockable after a certain period of time. For example, the configuration could be set to 1 hour and all chests placed more than an hour ago would be unable to be set to PRIVATE or PUBLIC. Owners could still make changes to chests they already set up. Making chests not lockable after a certain period of time would prevent mischievous players from locking other players chests that were left never locked. It would also deter abuse of the mod.
Possible Implementation:
Whenever a chest is placed, store the time it was placed in its NBT. When a player tries to lock a chest, check the difference between the current time and chest placed time. If the difference is greater than the number in the configuration, give the user an error message. If a chest doesn't have a placed time in its NBT, treat it as too old to be locked. (I don't know how Minecraft works so sorry if that implementation is impossible or too complicated)
Possible Issues
(P.S. I'm using the word "chest" above to describe any lockable block)