[SEC] Lockette - Simple chest and door lock, no databases! [Moved to BukkitDev]

Discussion in 'Inactive/Unsupported Plugins' started by Acru, Feb 14, 2011.

  1. Offline

    Acru

    Lockette - The sign-based container and door lock for Bukkit! - by Acru Jovian

    ElgarL has been assigned as the current maintainer of this project, please forward any important issues to him as well. This post is abandoned, but proceed to BukkitDev for updates.

    Download it at BukkitDev! (Alternate) (JAR) (Source), also view the Change Log on BukkitDev.



    Supported external plugins:
    • Permissions - Permissions/Groups
    • GroupManager - Permissions/Groups
    • PermissionsBukkit - SuperPerms/Groups
    • PermissionsEx - SuperPerms/Groups
    • bPermissions- SuperPerms/Groups
    • Towny - Groups/Zones
    • SimpleClans - Groups
    • mcMMO - Groups (Disabled by default now, due to issues.)
    • Factions - Groups
    • LWC - Zones
    • Register - Economy
    Alternate languages included:
    Confirmed compatible plugins: ColorSign, SpeedSign.
    Conflicting plugins: ChestShop, Most sign editors!


    The active Lockette information page will commute to BukkitDev soon, but the forum thread is still the best place for discussion.



    Overview:

    The purpose of this plugin is to restrict access to the contents of chests, dispensers, furnaces, and doors without the use of a database to track containers.

    To use, simply place a signpost on the floor directly beside a chest or other container to be locked. Enter [Private] as the first line. Your own name will automatically be entered on line 2 as the chest owner. Optionally type in the full names of two other users allowed to access the chest's inventory on lines 3 and 4.

    When done correctly, the sign will automatically fix itself to the side the target chest, protecting it from unauthorized access! Only the chest's owner can then break the sign or chest. (Warning: Anyone with permission to use WorldEdit commands or similar can circumvent the protection by removing the sign.)

    [​IMG]

    Additionally, you can enter [Everyone] on lines 3 or 4 instead of a user name to allow everyone access to the contents of a private container, or [Operators] to allow ops access. If a Permissions plugin is available, you can use groups like [Moderator] or [Admins] or others as defined in the Permissions settings files.

    The owner of a container can add more users by placing additional signs beside the container with the heading [More Users], where lines 2-4 specify the names of the additional users. You can edit the users on previously placed signs by right clicking the sign, and using the command '/lockette <line number> <text>' to change it.


    Working with Doors:

    To protect a door, you can use the same method as protecting a container, the sign will attach to the door automatically. In addition, you can attach a [Private] wall sign to any side of the blocks just above or just below a door. For double doors only one side needs a sign. Door support is enabled by default in the config file.

    Once a door is protected it will only open for someone listed as a user, and will not respond to redstone power or switches unless [Everyone] is listed as a user. Iron doors which usually won't open from clicking will work just as wooden doors. In addition, double doors will open together automatically!

    You can also use [More Users] signs as with containers, with the caveat that the sign cannot be placed on the block above the door if the [Private] sign is not above the door as well! (This is done to prevent a security uncertainty issue.)

    Protected doors will be closed automatically if a timer is set. A timer can be set globally with a configuration option, or individually for each door by using the tag [Timer: #] on line 3 or 4 of the [Private] sign, where # is the number of seconds that the door should remain open. If the timer is set to 0, this means the door will never automatically close. If no timer is specified, protected doors will use a global timer set in the configuration file. If the server is shut down cleanly any open doors will be closed, but in the event of a server crash while a door is open, it may remain so. Note that the initial state of a door is assumed to be closed.

    Care must me taken to place protected doors on a stable block. Building a door on sand, gravel, leaves, TNT and et cetera are allowed by the plugin, but cannot be secured fully. :3 Additionally, it should be noted that most status messages still refer to locked blocks as containers, so for the purpose of simplicity, doors should be considered as a type of container.


    Features:
    • No passwords or databases needed!
    • Permission checks run in constant time, no matter how many protected containers.
      • One owner and up to 11 additional users supported. (17 for double chests!)
      • Allows access to [Everyone] while still protecting the container from vandalism.
      • Allows group names in conjunction with many other plugins.
    • Special powers for ops or admins, configurable with permissions.
      • Reports when an admin does something naughty.
    • Protects single and double chests, dispensers, and furnaces.
      • Explosion and block-break protection for the protected container and sign.
        • Option to protect all containers from explosions.
    • Full support for doors, both wooden and iron!
      • Double doors are handled automatically, with no redstone.
      • Doors can be set to close automatically, via a timer setting.
      • Redstone hacking is disabled for protected doors.
    • Prevents creation of chests larger than 2 blocks.
    • Informative or helpful messages when interacting with containers.
      • The first time a chest is placed, a help message will be shown.
      • Types of messages shown are configurable in settings.
      • Additional language support.

    Advanced Setup (Permissions) (open)

    Advanced Setup:
    There are a few things you can now customize in the configuration files for the plugin, found in the plugins/Lockette folder. After running the plugin for the first time, two files will be created, config.yml and strings.yml. The first holds the following settings:
    • enable-permissions - Allows the use of permission nodes to specify who can do what. If this is disabled, groups will still be used but admin status is taken from the ops file. Defaults to false.
    • enable-messages-* - Enables or disables groups of messages listed in the strings.yml file. Not counting the broadcast ones.
    • broadcast-*-target - Sets the group or player that specific broadcast messages should be sent to. This can be set to "" for no one.
    • explosion-protection-all - Enabling this extends explosion protection to all containers on the server, not just [Private] ones. Default is disabled.
    • allow-admin-bypass - Allows admins to go though any protected door. Default is true.
    • allow-admin-snoop - Allows admins to peek into chests owned by other people. Default is false, and this setting is recommended! A broadcast message will be sent each time an admin snoops in a protected container where the admin doesn't have permission to. The message will be sent to a player or group as specified in another option. Admins can still break protection on chests if this is disabled, however.
    • enable-protection-doors - Enables support for private doors, defaults to true.
    • default-door-timer - Sets the door closing timer for all protected doors on the server, unless overridden by a specific sign. Defaults to 0, which disables the door closing timer.
    In the strings.yml file, you can set alternate language tags for [Private] and such, in ANSI format. If you need characters not in ANSI then you might try UTF-8 format, though it seems bugged tight now. The default alternate tags are in French, but server ops are free to translate the whole file into the language of their choice. If you do this, please share it back to me~ :3 If you want to disable only a specific message, you can set it to "", the empty string. Admins can use the command '/lockette reload' after editing the configuration files, to reload them.

    If a Permissions plugin is not available or the enable-permissions option is set to false, Lockette will use the ops file to determine who are admins. Admins can break the protection on any chest, and look inside protected chests (only if the related option is set), as well as reload the plugins configuration files. All non-ops will be able to create protected containers for themselves.

    If a Permissions plugin is available and the enable-permissions option is set to true, the following nodes will be used instead of the ops file and are included by default in the '*' node:
    • lockette.user.create.* - Permission required to create a protected container or door. Possible sub-nodes include chest, dispenser, furnace, and door. (The permission lockette.create.all is still supported, but obsolete.)
    • lockette.admin.create.* - Allows admins to create containers and doors for other users. Possible sub-nodes include chest, dispenser, furnace, and door. Leave line 2 blank for the default behavior or enter the name of your choice. Capitalization matters.
    • lockette.admin.break - Allows breaking protection on containers.
    • lockette.admin.bypass - Allows opening of any locked door.
    • lockette.admin.snoop - Allows peeking in protected containers. (The setting allow-admin-snoop must be true.)
    • lockette.admin.reload - Allows use of the reload command.

    Technical Information (open)

    Technical Information:

    This plugin has been tested and shown to be working for many builds of CraftBucket though a number of the more recent builds had a serious issue, so I'm suggesting a minimum build of 561 now. If you update past what is listed in the post's title and the plugin seems to break, it is probably not my fault. Post a note anyway and I'll see about fixing. I'll try and keep up with the new recommended build system, but for latest builds that break things, you should expect some time to pass before I take care of the issue, as this plugin is now mature. :3

    If there are multiple containers by the placed sign, the plugin will use the NESW rule to choose the first container that is not yet private. To elaborate, the plugin will check to the north of the sign first, and if no container or door is available to the north, it will continue checking clockwise around the sign.

    Due to the current implementation of the explosion event, this plugin will cancel all explosions that would damage the container or sign, rather than just remove the container and sign from the blocks to be damaged. Canceled explosions still knock signs off the walls. Canceled explosions leave signs looking blank, but this is just a graphic glitch, reconnect to fix.

    Bonus: This plugin will prevent chests bigger than 2 blocks from being created via glitches. (Again, this could be circumvented using WorldEdit commands, so take care who has access to such a plugin.)

    This plugin was inspired by the old hmod plugins Lock by Roman "kingseta" Pramberger and ChestCapsule by Fernando "Fergo".

    Hooking into Lockette (open)

    Hooking into Lockette:

    If you are a plugin author and want to connect to Lockette, you can use a public static function to get information about the protected status of a block.

    More info later, perhaps, but if you need the details now then go poke through the source~

    Future Possibilities:

    There are a number of things that have been suggested, and they tend to be added to the list below if I think they might be a good idea. However, some sort of locked container limit is requested often but this is not possible without a database to track the number of locked containers someone has. All things considered, this will not be supported. On the up side, without a database you can have literally millions of locked containers without any sort of lag, and there are permissions to restrict who can create locked chests. Perhaps only allow Moderators to create locked chests for other users, if you don't want to allow infinite locked chests.

    Aside what has already been implemented, the following may or may not appear in future versions:
    • Furnace/dispenser clusters, protected by a single sign.
    • [Log] sign to list recent users of a container or door.
    • iConomy fee for protecting containers/doors.
    • Worldguard connection.
    • [Protected] tag for viewing only.
    • Specific time range that doors can be opened.
    • DataLog plugin support.
    • More types of protected blocks, such as brewing stands.
    If you want any of the above features sooner than never, let me know! However, I currently see Lockette as functionally complete, for the most part, in that it already has all the functionality it needs. Future updates will mostly be to account for changes in Minecraft and Bukkit.


    Final Note:

    Please leave a reply if there are any bugs or suggestions, and if you like this plugin you can click the like button at the bottom of this post~ Thanks to those few that have donated! [​IMG]
     
  2. Offline

    Acru

    You can prelock the chests inside the rooms to [Everyone], then allow people to place signs. That way, they can't place signs on the already locked chests, only the doors. But it is also less secure as they might be able to glitch into the room and access anyone's chest. You would be better off locking chests.

    Yea, I had found the issue, but please reply to http://forums.bukkit.org/threads/4336/page-58#post-691364 before I make a fix.

    As for bypassing existing locked containers in wilderness, only admins can.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 18, 2016
  3. Offline

    Silarn

    Towny does prevent building in other towns, but the permission can be set by the owner so it's not a guarantee that outsiders will be blocked. In addition, admins can have a permission to bypass those protections. (I figure admins should be able to lock inside of towns as well since we can already open others' chests and assign chests to others. Or it could be another config option and permission node.)

    Apparently WorldGuard regions already prevent locks from being placed, however this may not work with the AutoLock feature. I do think that in general (assuming no permission node or config option set!) you should be prevented from locking or AutoLocking if you can't build in an area.

    ---

    Also, I have users reporting that they could open other locks. They could not open locks in my town, but come to think of it those people were already being prevented from doing so by Towny (with the possible exception of the furnace?). I will test with a town resident who does not have lock permission.
     
  4. Offline

    fysics

    I think we're have bigger issues, because some chest changes aren't being logged by logblock. Essentially, I can see in the logs when a certain item was put in (such as a diamond block), but it is conspicuously missing from the chest with no indication that it was taken. In other words, the logs don't match the contents of the chest. I've had this happen now to several people, most of whom I trust.

    We're also getting hit by a different caliber griefer/cheater than most servers would get, due to us being "featured" on http://youtube.com/teamavolition
     
  5. Offline

    Silarn

    @Acru Okay, after a series of tests:

    1. Chests do not seem to work. They act like they work, but people can access them anyway. I don't think this matters if it is in wilderness or not.

    2. Everything else works. Doors can't be opened, furnaces can't be used, etc.

    3. Towns block everyone from creating new locks. Doesn't seem to matter who is a member.

    4. Aside from chests being bugged, wilderness permissions work correctly!
     
  6. Offline

    King_KYl3

    yer i have rooms no1 can get into them. put wat i was asking was about was like a command and then they right click the door and it places a sign on it or somethink cuz they carnt place signs in my protected area please figure somthink out Thanks :)
     
  7. Offline

    Silarn

    LogBlock chest logging relies on Spout. I'm not sure that has anything to do with Lockette. And Spout has yet to release an official 1.8 version.
     
  8. Offline

    fysics

    Right. I have chest logging enabled and I'm running a dev build of Spout. *Most* chest actions are being logged. The ones where they're bypassing lockette are not logged. This is why I think the bug is not in Lockette itself, rather in Bukkit or some other plugin. In order to replicate the bypassing, I'd have to figure out who it is and somehow get them to cooperate with me, and I doubt that will happen.
     
  9. Offline

    Acru

    Okay, update, I had a look and its totally obvious which chests are pre and post 1.8. All the earlier chests have data 0, and all later have data 2-5 for a direction.

    The problem, for single chests there are four possible orientations and double there are two, I guess MC decided direction automatically before by the direction of air, etc.

    So I have to come up with a criteria for which direction to face chests based on the surrounding blocks. Any suggestions? (This would be basically like Tahg's touch activated fix.)
     
  10. Offline

    Kane

    I'm no programmer but could we just makes them auto face the direction the player is? I assume once you click them they restore normal but I mean the opening chest front maybe just towards the direction clicked on by?
     
  11. Offline

    Silarn

    I'd say if there is an adjacent block, that should be the back. If there is more than one adjacent block, just pick whichever is the lowest data value (which faces away from the block). And 2 for no adjacent blocks.

    If you want the id of the block to matter, then that could be a lot of things.
     
    Kane likes this.
  12. Offline

    Acru

    Probably the simplest solution is to click the side of the chest that should be the front.
     
    Kane likes this.
  13. Offline

    Kane

    Sounds good. And thank you so much. Godcraft loves you for this!
     
  14. Offline

    Silarn

    I guess I didn't understand the question. This is going to reorient the chest when you lock it?
     
  15. Offline

    Kane

    no I think click it.
     
  16. Offline

    Acru

    Incidentally, It is kinda neat for a chest to always rotate to face you when you open it, not just when the data is pre-1.8~

    So I'm throwing in a configuration option for that, defaulting to false. Incoming update.
     
    khamseen_air and Kane like this.
  17. Offline

    Kane

    Thanks so much any crazy way to add say a ctrl button or anything? Not sure if default Minecraft can detect keys without spout.
     
  18. Offline

    Acru

    I don't believe bukkit provides that information, but I could be wrong? Let me know how your chest fixings go~ heh
     
    Kane likes this.
  19. Offline

    Kane

    <3 You made this plugin at my request you fixed the mass chest bug and now you fixed notches dirty work. I really love your plugin and work :) I really can't wait for the future of this plugin.
     
  20. Offline

    Acru

    In theory it should be possible to catch all such events, perhaps the logger is missing things because events are canceled but then uncanceled? Thugh this is more an issue for the logblock author.

    As for bypassing lockette, we need to find the cause, and it is likely another plugin doing as I said above, uncanceling an event. (Specifically, using setUseInteractedBlock with something other than DENY, during an onPlayerInteract event with an action RIGHT_CLICK_BLOCK, the target being a chest.)

    Edit: Also see my next post and see if you can find the plugin causing, please~

    <3> I fixed in 1.4.4, hopefully. I'm letting Towny decide who can build where, except for in wilds as in <4>.
    <1&2> Since furnaces/doors work right and chests don't, this has to be another plugin interfering with Lockette's operation. (As I mentioned in thy prev post.)

    Can you disable plugins a few at a time, and see if the problem goes away, then add them back one at a time until the problem returns, to find out which? On a clean server I can't reproduce this problem, and trying to replicate your setup may not be possible.

    What you need to do in your block protection plugin (regios I think you said) is allow people to place signs. I looked at the wiki and didn't see any filters for the type of block, so you can't do it that way, but what you could do is make a 1x1x1 sub-region over each door that anyone can place blocks in.

    Then do something like 'place sign here --->' right beside.

    I am not going to add any sort of command to place a sign despite region protection, as this would get me into all sorts of trouble with all the region protection plugin makers. :3

    Incidentally, this is already done. Anything that doesn't allow placing a sign therefore doesn't allow locking a container. (The 'autolock' method just changes the type of interaction from open chest to place sign, but it still must pass the block place event uncanceled.) But don't miss my previous post to you. :3

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 18, 2016
  21. Offline

    King_KYl3

    ;( would be so hard tho but you could make it so it has a command only if they want to use it so you can place sign and do all the normal stuff put they have an option to do the normal way or use command way Please try add it i would be so thankful and every one make that idea come to use!
     
  22. Offline

    Silarn

    @Acru I have a suspicion that the chest problems are being caused by the OpenInv plugin, despite normal users not having any permissions for it. They added a random feature to let you open chests with blocks above them. This seems to have been interfering with other plugins like LWC so it's probably the culprit.


    There is an update, however, so I will test it as soon as possible. (Nobody on-server currently.) If the chest problem still happens, I will remove it and see what happens.
     
  23. Is the sign Protected from Being Destroyed after placement on or near Chests and doors and such? (By Being destroyed , I mean by other users , not me)
     
  24. Offline

    Acru

    Let me know, thanks~ (OpenINV is on my old 'incompadible' hit list, too. o3o)

    The sign is protected and the block the sign is attached to is protected. The other half of a double chest is protected. If it is a door, all connected doors are protected and the blocks under the doors are protected. For hatches the hinge block is protected. Also people are blocked from making it double chest or a double door, etc. :3

    Protected means protected from breaking, exploding, or things like pistons, but not the sand/gravel gravity effect.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 18, 2016
  25. Offline

    khamseen_air

    Yes, protection signs can only be removed by the person who placed them, or an admin with the appropriate permission node. :)
     
  26. Offline

    Acru

    I will consider this as an option for doors, as a quick-protect method. Right click door with sign to protect, a sign appearing above the door on the same side if there is space, but the option will default to false if so. And it isn't a high priority, I want to improve other aspects first~
     
  27. Offline

    King_KYl3

    Oh ok f.e hope you do it alot will use it xD

    Would you hopfully say a week xD?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 18, 2016
  28. Offline

    Sketaful

    A logsign would be awesome. fun to see who used a door the last time ;D
     
  29. Offline

    Semirotta

    not working in recommended bukkit 1.8.1
    ppl can open chests no matter what, ive tried LWC and this and both wont work on CHESTS... doors will b protected
     
  30. Offline

    Silarn

    Do you have OpenInv?
     
  31. Offline

    Semirotta

    Yes i do, why?
    It shouldnt cause trouble? i tried LWC and Lockette -> both wont protect CHEST but protects door.
     

Share This Page