Latch - A locking plugin to protect your containers


This is a discussion topic for the Ore project, Latch. View the full project on Ore for downloads and more information.

:lock: Latch

Latch is a locking plugin allowing players to protect blocks like chests/furnaces/doors from being accessed by other players.

Release / Source Code

Currently built against Sponge API 7.0.0, but we also have a build for API 5.2.0.

You can download the latest release here on Ore.

As well as view the source code on Github.

Please report any issues you find or features you desire here or on our issue tracker.


  • 5 different types of locks
    • Public locks - anyone can access, just applies protection
    • Private locks - only players the owner adds can access
    • Password always locks - players with the password can access (required to type every time)
    • Password once locks - players with the password can access (only need to type the first time)
    • Donation locks - (applies to containers) only players the owner adds can withdraw, anyone can deposit
  • Lock protection from players, pistons, (optionally) explosions, (optionally) redstone
  • Configurable lock limits per type or total per player
  • Configurable lockable blocks
  • Configurable redstone and explosion protection
  • Locks saved to h2 database

latch.conf, stored in the /config/latch subdirectory

  • add_default_permissions - adds the “latch.normal” default permission as true
  • lockable_blocks - blocks that can be locked by players using this plugin
  • protect_from_explosives - should locks be protected from explosions
  • prevent_adjacent_to_locks - blocks to prevent being placed next to locks the player doesn’t own
    • Hopper here by default until Sponge adds necessary events to protect the locks
  • protect_below_block - locks that should also protect the block below them
    • Doors here by default until there’s some way to protect them when the block below is broken
  • lock_limit - limit for “total” locks per player, or per type of lock
    • public, private, password_always, password_once, donation
  • protect_from_redstone - allow locks to be protected from redstone
  • auto_lock_on_placement - whether or not blocks which can be are automatically locked on placement
  • remove_bypass_on_logout - whether or not admin bypass is removed on logout
  • clean_old_locks - whether or not old locks should be automatically deleted
  • clean_old_locks_older_than - how old locks need to be to be automatically deleted
  • clean_old_locks_interval - how often Latch should delete these old locks

Latch uses Sponge’s short and long command flags for some commands.
-p can be added to most commands to persist the command after use.

  • /latch or /lock - base for most of the commands, displays plugin information
  • /latch help - list help for the commands
  • /latch private - create a private lock on the next block placed/clicked
  • /latch password [password] - creates a password lock with the given password (add below flag for different type)
    • -a - require a password every time to access (default)
    • -o - require a password once to access
  • /latch change - change the attributes of one of the locks you’re the owner of (add below flags, multiple flags can be used)
    • --type=[PRIVATE, PASSWORD_ALWAYS, PASSWORD_ONCE, DONATION] - changes the lock type
    • --password=[password] - change the password of the lock (resets the access list)
    • --add=[player] - add the player to the lock access list (can have multiple within a single command)
    • --remove=[player] - remove the player from the lock access list (can have multiple within a single command)
    • --owner=[player] - gives the lock to another player
    • --redstone=[true/false] - prevent redstone interactions from occurring on this lock
  • /latch delete - remove a lock you’re the owner of
  • /latch persist - duplicates the functionality of the -p flag (persisting the last command typed)
    • Use again to turn off the command, or use /latch clear
  • /latch info or /latch display - display the lock name, owner, object and players that can access
  • /latch list - display all of your locks
  • /latch list [player] - to display all of a player’s locks (requires latch.admin.list permission)
  • /latch limits - to see how close you are to your limit of each lock type
  • /latch limits [player] - to see how close another player is to their limits (requires latch.admin.limits permission)
  • /latch open [password] or /unlock [password] - to attempt to open a lock with the password
  • /latch add [player] or /latch remove [user] - modify the users allowed to access the lock
  • /latch purge - deletes all of your locks
  • /latch purge [player] - deletes all of the locks of the specified player (requires latch.admin.purge permission)
  • /latch bypass - enter bypass mode as an admin to access other’s locks
  • /latch clean [days] - deletes all locks older than the specified amount of days

Each command has its own permission node under latch.normal (i.e. for the /latch info command).
Other permission categories below:

  • latch.normal - base for non-admin permissions/access
  • latch.normal.create - base for lock creation permissions
    • latch.normal.create.password.always - allows creation of a password_always lock
    • latch.normal.create.password.once - allows creation of a password_once lock
    • latch.normal.create.private - allows creation of a private lock
    • latch.normal.create.public - allows creation of a public lock
    • latch.normal.create.donation - allows creation of a donation lock
    • latch.normal.purge - allows deletion of all of your locks
    • latch.normal.limits - allows a player to see how close they are to reaching the server limits
  • latch.admin - base for admin permissions/access
    • latch.admin.list - allows use of /latch list [player] to display a player’s locks
    • latch.admin.purge - allow use of /latch purge [player] to delete all of a player’s locks
    • latch.admin.bypass - allows entering a bypass mode where you can access any lock
    • latch.admin.limits - allows use of /latch limits [player] to view how close a player is to the server limits
    • latch.admin.clean - allows an admin to delete all locks older than a specified amount of days

Latch v0.1.0 :unlock:
LWC-like locking of doors, chests, etc

The plugin for now has most of the locking functionality which LWC had with some nice additions such as naming and listing all locks, but there is some we still need to work on. Following are some things we plan to work on soon in no specific order, so if you have any suggestions relating to those or something else you'd like to see in the plugin please notify us. I would especially like input on some of the possible features to see what people think.

Planned Features:

  • Locking and protection of entities such as armor stands, item frames, et cetera
  • An admin bypass mode to destroy locks they do not own
  • A purge command for admins to use to get rid of all of a player's locks. Can be useful if they are banned
  • More simplified commands for players who do not like the flag system
  • Switching of some messages to the action bar instead of chat
  • Redesign of information command display and lock list
  • A command to transfer all of your locks to someone else
  • Better handling of hoppers
  • Better protection of redstone if enabled
  • Either as a module or additional plugin - A lockpicking feature for players to bypass locks and steal things
  • Integrations with grouping plugins like Guilds
  • A public API to access some info about locks and listen to our custom events

Possible Features:

  • A way to do lock limits per person
  • Config option to automatically add all detected containers to lockable list
  • Commands to modify configuration from in-game
  • A way to visualize all locks you own around you with particles or similar
  • Keeping locking data attached to shulker boxes
  • More ranks for locks instead of just owner and accessors.


Hello there everyone, I am here with a new update for Latch. None of the features I mentioned previously are added yet but there is some good within this update. Please update as soon as possible and make sure to notify your users of the notice.

Due to Ore not allowing me to update a new version, you can find this release on Github. As a disclaimer, these releases have not been reviewed by Sponge staff.

On bStats I see we are up to 5 servers, so thank you all for using Latch and sorry for the inconvenience mentioned in the notice below. We hope to create some great releases soon, so keep your eye out.

Here is the release post:

:lock: Latch v0.2.0

NOTICE: Your users with password locks will need to change their passwords using the command "/latch change --password(password goes here)" with no parentheses and putting in their desired password. The owners will still be able to access their chest, but there were problems with how the passwords were saving. We fixed the issue and made passwords a little more secure with this update. Again, I apologize for the inconvenience.

With this release there were some nice quality of life changes, password fixes, a new configuration option, and some small performance improvements and fixed event checks.

Make sure to match your Sponge API version to the proper jar. The 5.1.0 build will work on 6.0.0 too though and it may also work on 5.0.0 but no promises.



  • A configurable feature which automatically locks blocks on placement. Disabled by default. Thanks @Adnan for the suggestion.
  • Properly informs players if they have persisted a command.


  • Locks no longer generate a salt if they don't need to.
  • Owners of doors can now destroy the block underneath them.
  • Fixes passwords not being saved in the right format. Read the notice above.
  • Fixed problems with persistence not working with some commands.
  • Small performance and memory improvements throughout.

Code changes

  • Removed minecrell's maven repo from our build.gradle repositories
  • Switched to jcenter instead of mavenCentral
  • Updated Gradle wrapper from 3.2 to 3.4
  • Lots of small formatting changes


Hello again I am here with a new update to Latch. Unfortunately Ore did not automatically make a post, but the latest version is up. You can find the download for version 0.3.0 here. I hope you enjoy the release! @Nighteyes604 is like a professional bug fixer.

:lock: Latch v0.3.0


Requires more recent builds of SV 1.11.2 and SF 1.10.2/1.11.2, and the most recent SV 1.10.2 build.

NOTICE: Donation chests did have some fixes with this update, but due a Sponge issue sometimes people without access are able to take items out. This is due to an issue in Sponge reported here. It is up to you, but it may be in your best interest to limit donation chests to 0 or at least warn your players. We tried to work around the issue but could not, so hopefully a fix will be out soon.

With this release there are some important fixes from a duplication issue with donation chests, pistons being able to break locked blocks such as doors, certain blocks being stuck in one state, and some notifications being missing. There are two new admin commands as well. We hope you enjoy this release and keep the bug reports coming in.


  • /latch purge (player) command which as a player will delete all of your locks or if you have the admin permission will allow you to delete all of someone else's locks. latch.normal.purge and latch.admin.purge are the permissions for this.
  • /latch bypass command which puts an admin in bypass mode where they can access other's locks. The permission for this is latch.admin.byass.
  • Small performance enhancements due to changes in event handling.


  • Plugin description no longer mentions lockpicking.
  • State of blocks like buttons and furnaces no longer stay in the state they started out when they were locked or a block around them was.
  • You can no longer duplicate items with donation chests. Read notice above for continuing issue with donation chests.
  • There is a notification now when you break a locked block.
  • All of "Click here for Latch help." in "/latch" now executes the command properly.
  • Pistons no longer can destroy locked blocks in any version.
  • Delete message now properly only displays once per lock.

Code changes

  • Removed useless CommandFlags.Builder in PersistCommand.
  • Enables functionality of basic admin bypassing through changes to locks
  • Small optional use changes
  • Use dedicated ExplosionEvent.Post event instead of ChangeBlockEvent.Break
  • Small code style changes
  • Modify handling of redstone protection.
  • Adds SQL statement for deleting every lock of a player's.
  • Updated prevention of pistons generating items from unbroken locks.


Heya, found a few more bugs worth mentioning:
- Sticky pistons are able to push/break certain locks (all pressure plates, buttons, levers, doors, all trap doors, and all gates from what I've tested) along with their protected below block if they have one, leaving an invisible locked block behind (normal pistons don't seem to have this issue)
- Explosions are still able to destroy below blocks, which ends up destroying the locked object as well
- Redstone protection doesn't seem to be working

And a few more suggestions:
- In admin bypass mode, display the output of the "/latch info" command
- Prompt the user to enter a password for a password locked item when they try to access it
- Add an additional warning/confirmation message to the "/latch purge" command
- Notify user that entered the "/latch purge (player)" command rather than the user that was cleared
- Bulk edit flag for "/latch change"
- Add lock type to "/latch info"
- List changes done from "/latch change" command
- Allow "/latch list" to be used on offline players
- Prevent unauthorized users/entities from triggering locked pressure plates

Config used:

Really looking forward to seeing this plugin functioning as planned! :smiley:


@Dead_Island_Dude Hey thanks for the reports again. We were not able to get some of your suggestions in for this release, but don't worry they should be in a 0.4.0 release coming soon enough. I really appreciate your in-depth testing, it keeps us on our toes, so keep it up. Sorry that there has been so many issues. But hey here's a minor release which fixes some of your bugs to hold you over.

:lock: Latch v0.3.1

This release fixes a few glitches with Latch v0.3.0 and possibly before.

We urge you to use the latest version of your respective Sponge software for the best performance and compatibility.

NOTICE: I still recommend limiting donation locks to 0 as there are some problems which continue to persist. We are hoping some fixes to Sponge itself will solve the problem soon enough. Sorry about the inconvenience.


With this release there are a few bug fixes. We were not able to fix all bugs for this release but we wanted to get some of the fixes out so expect a 0.4.0 release sooner rather than later with more fixes and some new features. We hope this update pleases you and make sure to keep the issues coming.


  • If you use protect from redstone and have it enabled on your lock, if you or someone with access is the source of the input the redstone input will still work. For example if you have a door locked with redstone protection on, you will still be able to open it with a pressure plate as will your other accessors.


  • Deleting a locked container no longer destroys every item. See
  • "/latch list (player)" can now be used on offline players
  • Explosions are no longer able to destroy blocks which locks(doors) depend on.
  • Sticky pistons will no longer break locked blocks.
  • Fixed some issues with protection from redstone not being enabled when it should be
  • Fixed redstone protection in general
  • Removed some extra spaces in pagination titles

Code changes

  • Added more usage of the this keyword where appropriate
  • Removed the SpawnEntityEvent listener as it is no longer used due to piston fixes
  • Removed some unused methods
  • Continued to unify format


Meronant: Would you be able to come on #spongedev? I'd like to get that dupe issue you're experiencing fixed, and it would be helpful to be able to hear about the issue and/or debug it with you?


@Meronat The spam shift click issue you mentioned earlier should be fixed in the latest SpongeForge.


Thanks for your help, I'll test it further when I can.


Any chance there could be a purge command/function for unused/old locks?
I love the idea of purging per player, but locks that go unused for a while (and it's unknown about this) can just build up on a server. Leaving locked chests everywhere.
To solve that, staff would need to check regularly every player to see when they were last online. :frowning:

A purge setting for "days inactive" that the lock wasn't used?
Help keep abandoned locks off the server. ^.^


We are currently changing some of the internals to more easily support new information. I think we'll include something like this or at least a rudimentary version of this in the next update. Thanks for the suggestion.


Hello my friends, today I am here to learn what people would like to see in the next release of Latch. It may take a little longer but it will be a larger release, hopefully fixing a majority of the remaining bugs people are seeing as well as implementing a lot of major missing features.

@Zera_Fox, @Dead_Island_Dude, @turtledude01, @Vectrix, and everyone else who is interested I am curious what you guys would like to see in the next release or two of Latch. Here are some of the things I would like to get in the plugin outside of bugs pretty soon, no promises though:

  • Better formatted lock information for "/latch info".
  • A confirmation for the purge command.
  • A prompt to enter a password on password locked chests.
  • A purge command based on length of time not accessed.
  • More descriptive change result commands.
  • This one is a big one and may take longer, but entity locking is a major goal.

Thanks everyone for extensively testing Latch and making good use of it. We appreciate it and want to get the plugin to where you guys all would like to see it. :lock:

If you ever want to talk or need some help, feel free to reach out to me on here, on Github, or on our Discord.

Side note - If anyone has the ability, we are looking for a pretty simple logo to use for Latch as neither of us are artistic in any way.


I have a few small ideas for what could be added. I asked around on my server which uses Latch and loves it and this is what was requested:

  • Use permission options to set how many maximum latches are allowed by a group/player
  • /latch shows plugin information right now I think for most players it would be better to show the current /latch help on typing /latch. And change the current /latch to be /latch version
  • Ability to add everyone that has a permission group to a lock
  • Toggle redstone per latch, maybe other flags per lock such as mob greif and hopper access from non locked hoppers.
  • Temporary unlock for everyone
  • Economy integration (sorry if this has already been added, I'm just looking in the configs for what is/isn't added)

If you would like me to put these as a Github issue I will be more than happy to, thanks for the plugin!


Thanks for the suggestions and asking around, I'm glad you like the plugin so far. I think most of these can be done, but do you mind elaborating on these points: "Ability to add everyone that has a permission group to a lock" and "temporary unlock for everyone"?

Relating to toggling redstone per latch, that should be able to be done with the "/latch change --redstone=[true/false]" command. Sorry that this is not so intuitive, I am working on some easier commands as well. We are working on a flag system for values like those extra mentioned, hopefully we can get it into Latch soon, but what do you mean by protection from "mob grief"?

For economy integration, should there be an optional price per type of lock or just a global price?


The first point, adding everyone from a permission group to a lock, would be like, if i add "group:mod" to the lock, then everyone in the permissions group of Mod would have access to that lock. the temporary unlock would be that, say, i want to remove the lock, but only until i log out or do a command. And by mob greif i meant more like Creeper explosions, tnt explosions etc. And it would be nice to have the Economy integration per lock type so that it is more extensible for whatever application someone has for it. Thanks!


*applies advanced MS Paint (actually google drawing) skills*


More suggestions, as requested:
- Economy cost per lock
- Admin locks (Locks that don't belong to a specific player, but to the server)
- Bulk editing specific block locks/all block locks (ex. add/remove specific user to all locks, transfer ownership of all locks, etc.)
- Keys migration (To try to get more people to switch to Latch)


:lock: Latch v0.4.1

I highly recommend using the most recent build of Sponge applicable to your version of the game due to some recent changes which fix issues with containers in general.

NOTICE: There was a way to get infinite experience in Latch before this release with donation furnaces you didn't have access to, but that has been resolved in this release so I highly recommend you update to this release.

With this release there are some important fixes from an infinite experience issue, players not being able to place containers after they reached the private limit, an exception when changing to a name that was taken, and much more. There were also many new features including the new limits commands, the new clean command, many shortened commands, and some other nice things which you can find below. I hope you enjoy this release and as always if you have issues or suggestions please report them on our Github. You can find this release on our Ore page.


  • "/latch" now displays the help and the information has been moved to "/latch version".
  • Added a clickable confirmation to the purge command.
  • Added a last accessed piece of information to locks. This is in "/latch info" as well.
  • Added "/latch clean (days)" which deletes all locks older than the specified amount of days and has a clickable confirmation.
  • Three new config options to clean locks automatically:
  • "clean_old_locks" whether or not locks are deleted/cleaned automatically.
  • "clean_locks_older_than" how old the locks must be to be automatically deleted.
  • "clean_old_locks_interval" how often Latch should check to delete locks.
  • Redesigned the "/latch info" command to look a little nicer and include more information.
  • Added a "/latch limits (player)" command which lets you see how close to the limits you are or if you have the latch.admin.limits command see how close others are.
  • You can now optionally provide a name for the lock when creating a private lock."/latch private (name)"
  • There are many new shortened commands for the lazy ones of you out there: "/lunlock", "/lprivate", "/ldonation", "/lpassword", "/lpublic", "/linfo", "/llist", "/ldelete", "/lpersist", "/lchange", "lpurge", "/llimits", "/lclean", "/lbypass", "/lby", "/ladd", "/lremove", "/lhelp", and "/llatch". They do what you'd expect them to.


  • Fixes an issue where players could create infinite amounts of experience trying to take items from the result of a donation furnace they did not have access to.
  • You are now able to place lockable items even if you are at the private lock limit and automatic locking is enabled.
  • Fixed some messages simply being wrong.
  • Containers now longer open if you are changing them.
  • Fixed an exception when you tried to set the name of a lock to a name already taken.
  • Other general fixes :slight_smile:

Code/project changes

  • Removed our workaround for fixing a dupe issue when ClientInventoryEvents were cancelled as it was fixed in Sponge yay.
  • Updated the Gradle wrapper.
  • Began using a Info class and Gradle blossom plugin so we only have to change plugin information in one place.
  • Updated the license and changed the format of it a bit.
  • Removed some unnecessary code and comments.
  • Continued to unify the style of the code.
  • Began to use Travis to verify builds working on commits and pull requests.
  • Changed name of some classes/variables to better signify purpose.
  • Removed TODOs that we have finished.
  • Command registration has been moved to its own class and the command builders are there as well.
  • Fixed some spelling and grammar mistakes in comments and elsewhere.


I apologize for the lack of discussion recently. At the moment Latch v0.4.1 is kicking along with no major issues that we are aware of. Although not much development has occurred in the past few weeks, I have been working on cleaning up our code a little and aligning it to one style to make it easier to contribute. This work will continue soon into more cleanup of how we handle commands, interactions, configuration, and other pieces of the plugin while we introduce some new concepts such as "flags/attributes" which will be greatly beneficial once entity locking is introduced. So the next update will not be for a while, outside of major bug fixes, but we hope it will be a good one with some highly requested features such as economy integration. As always keep the bug reports and feature requests streaming in.

Thanks my friends,


Edit: Oh yes, I also plan to work on better, more detailed documentation soon including videos so be on the lookout for that.


:lock: Latch v0.4.2

As always I recommend you use the latest build of Sponge matching your version and you keep backups of your lock database!

This release mostly involved internal changes, making development slightly easier and cleaning up the code base, hopefully making it slightly easier to contribute to. We have some great features in mind, but just haven't had the time to work on them lately and plan to get back to it eventually, so don't give up on us just yet. You'll also find in this build that some edge cases causing problems should be fixed and if you had a problem with the plugin launching due to bStats that should be fixed as well. I hope you enjoy this release and as always if you have issues or suggestions please report them on our Github.

You can find this release on our Ore.


  • The binary should be around 10-15 KB smaller.


  • Changing the name didn't actually change the name but now it does.
  • Should no longer have occasional startup issues due to bStats.
  • Other general fixes :slight_smile:

Code/project changes

  • Added some new project information, but very basic. Will expand more on it later, hopefully making it super easy to contribute in the future.
  • Updated the Gradle wrapper.
  • Continued unification of code style to Sponge's code style. Still work in progress but a lot of problems have been fixed. It is still slightly opinionated as well.
  • Switched to using bStats' maven repo instead of including the class manually.
  • Switched to using bStats Lite instead of normal as we don't add any custom charts at the moment.
  • Changed some field and parameter names for simplification and ease of readability.
  • Now uses a builder to construct locks. Will be expanded once a public API is released.
  • General changes.