[MECH] ContainerProtect v1.09 - Chest, Furnace and Dispenser control [600-818]

Discussion in 'Inactive/Unsupported Plugins' started by FloydATC, Mar 5, 2011.

  1. Offline


    ContainerProtect - Chest, Furnace and Dispenser control
    Version: v1.09

    This is my own replacement for the old ChestProtect, which seems to have been abandoned. This plugin works in pretty much the same way, but handles furnaces and dispensers as well as chests. Operators and admins may be granted access to use and destroy containers regardless of protection, through special permissions.

    Note that the old ChestProtect data file is currently not used or converted automatically. I have included a Perl script at the bottom of this post.


    • 4 modes supported: Public, Private, Players and Groups
    • Use in the same way as ChestProtect: 1. set mode, 2. place container
    • Supports chests, furnaces and dispensers
    • Simple, fast and reliable
    • Log container access for chosen players or groups
    Download http://minecraft.atc.no/plugins/ContainerProtect.jar

    Source code is included - no strings attached, no warranties implied

    • 1.00 - Original release
    • 1.01 - A few minor tweaks to the log output
    • 1.02 - Improved parsing of improperly formatted/imported modes
    • 1.03 - Mode checker stupidly refused uppercase characters. Fixed.
    • 1.04 - Mode checker would incorrectly accept a player name with /cp 2. Fixed.
    • 1.05 - Changed to use onPlayerInteract() instead of onBlockInteract() which was removed in #600
    • 1.06 - Added null Block check to isContainer()
    • 1.07 - Added optional permissions to control logging
    • 1.08 - Players could bypass security on single chests. Fixed.
    • 1.09 - Fixed optional permissions to control logging accidently broken in 1.08...
    • Requires Permissions.jar (2.5.4 or compatible)
    • Download and copy to your "plugins" directory
    • Optionally create the directory "plugins/ContainerProtect
    • 'containerprotect.use' required to access '/cp' command
    • 'containerprotect.open-any' required to bypass use protection
    • 'containerprotect.destroy-any' required to bypass destroy protection
    • 'containerprotect.no-log-deny' to not log unsuccessful access
    • 'containerprotect.no-log-permit' to not log successful access
    • '/cp 1' sets current mode to 'Public' (This is the default)
    • '/cp 2' sets current mode to 'Private'
    • '/cp 3 name1 name2 nameN' sets current mode to 'Players' and grants access to named players
    • '/cp 4 group1 group2 groupN' sets current mode to 'Groups' and grants access to named groups
    • Place the chest, furnace or dispenser. The current protection mode will be applied.
    • Note: When placing double chests, each half chest is handled independently. I highly recommend using the same mode for both to avoid confusion.
    How to convert your old 'lockedChests.txt':
    Copy the following perl script (save as convert.pl):
    while (my $line = <>) {
      $line =~ s/[\r\n]//g;
      my ($acl, $x, $y, $z, $mode) = split(/\,/, $line);
      next unless defined $mode;
      print $x . "," . $y . "," . $z . "=" . $mode . " " . $acl . "\n";
    Then run it in your minecraft folder:
    perl convert.pl < lockedChests.txt > plugins/ContainerProtect/locations.txt
  2. Offline


    Running with CB 612 throws occasional error messages. I can't pin down exactly when this happens, but is seems to me, there were changes in the way, events are handled:

    2011-04-01 10:29:05 [SEVERE] Could not pass event PLAYER_INTERACT to ContainerProtect
        at no.atc.floyd.bukkit.cp.ContainerProtect.isContainer(ContainerProtect.java:348)
        at no.atc.floyd.bukkit.cp.ContainerPlayerListener.onPlayerInteract(ContainerPlayerListener.java:35)
        at org.bukkit.plugin.java.JavaPluginLoader$9.execute(JavaPluginLoader.java:214)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:255)
        at org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:162)
        at org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:133)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:661)
        at net.minecraft.server.Packet18ArmAnimation.a(SourceFile:35)
        at net.minecraft.server.NetworkManager.a(NetworkManager.java:198)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:72)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:368)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
    Hopefully, this helps :)
  3. Offline


    If I were to venture a guess from where I'm sitting, about 12km from the source, I'd say this is caused by events with no block reference. If this is the case, the error should be relatively harmless. Either way, I'll have a look at it when I get home.
  4. Offline


    I can confirm ronix' error message. It's actually popping up everytime somebody touches a block.
  5. Offline


    I am unable to reproduce the problem so this may be caused by a conflict with another plugin or some other factor that I didn't think of yet. So... I have just posted an update to version 1.06 which checks for a valid result from event.getClickedBlock() before trying to use it. Please let me know if this takes care of the problem.
  6. Offline


    Thanks a lot - seems to fix this issue. By the way: The log tells me:

    2011-04-02 05:03:21 [SEVERE] Nag author: 'Reil' of 'rTriggers' about the following: onPluginEnable has been replaced with a new signature, (PluginEnableEvent)
    ... I have the same problem with my own plugins ;-)
  7. Offline

    Noctis Akatsuki

    Is there a way to remove the spamming of the commandwindow, whenever people use/sets a chest?

    10:22:13 [INFO] [CP] Arifiene used container with mode Public
    10:22:17 [INFO] [CP] Arifiene used container with mode Public
    10:22:29 [INFO] [CP] Arifiene used container with mode Public
    10:22:40 [INFO] [CP] Arifiene used container with mode Public
    10:23:16 [INFO] [CP] Arifiene used container with mode Public
    10:23:38 [INFO] [CP] parrotofdoom used container with mode Public
    10:23:46 [INFO] [CP] Arifiene used container with mode Public
    10:23:46 [INFO] [CP] parrotofdoom used container with mode Public
    10:23:56 [INFO] [CP] Arifiene used container with mode Public
    10:25:21 [INFO] [CP] Arifiene used container with mode Public
    10:25:29 [INFO] parrotofdoom lost connection: disconnect.quitting
    10:26:12 [INFO] [CP] outern88 used container with mode Private: outern88
    10:26:14 [INFO] [CP] outern88 used container with mode Private: outern88
    10:26:17 [INFO] [CP] outern88 used container with mode Private: outern88
    10:26:26 [INFO] [CP] outern88 used container with mode Private: outern88
    10:26:28 [INFO] [CP] outern88 used container with mode Private: outern88
    10:26:32 [INFO] [CP] outern88 used container with mode Private: outern88
    10:26:36 [INFO] [CP] outern88 used container with mode Private: outern88
    10:26:39 [INFO] [CP] outern88 used container with mode Public
    10:26:43 [INFO] [CP] Arifiene used container with mode Public
    10:26:44 [INFO] [CP] outern88 used container with mode Public
    10:26:51 [INFO] [CP] outern88 used container with mode Public
    10:28:27 [INFO] [CP] Arifiene used container with mode Public
    10:28:53 [INFO] [CP] Arifiene used container with mode Public
  8. Offline


    I can make the logging configurable, sure. Give me a few days though, I'm kinda busy this week :-/

    Update: v1.07 posted. I have added two optional permissions:
    • containerprotect.no-log-deny
    • containerprotect.no-log-permit
    The default behaviour is still to log all container access but as an administrator you can now exempt chosen players or groups from being logged. Please let me know if this works better for you.
  9. Offline


    hello your plug-in looks really nice.
    But is it possible to add a limit to the amount of chests that are protected per group and per person? if so this would be really nice. thanks
  10. Offline


    This is a great plugin :). The only other option I would like is to be able to update previously placed chests. Maybe something where you can update the chest your currently facing? I know InventorySort has code that sorts chests based on which chest the user is facing. Maybe something similar to that?
  11. link dead

    edit: second click have download
  12. Offline


    Shouldn't be too hard I guess, maybe a command like "/cp poke" to do the update. Give me a few days.
  13. Offline


    I've updated my server to 1.4 a few days ago. Today I realized, that everybody has access to others private chests. The permissions-nodes should be working, I did not change any nodes related to CP.
    The serverchat tells me that the chest belongs to player xxx and the permission is denied, but anyway the chest still opens...
  14. Offline


    Do you have any other chest protection plugins that may be overriding CP, such as cuboid? Some plugins fail to notice that an event has been cancelled and "uncancel" it based on their own rules. Some of these can be told to ignore chests. I remember having this problem with the original CuboidPlugin vs. ChestProtect. I run ContainerProtect in tandem with the newest WorldGuard and it seems to work as expected.

    I'd love to hear more about your setup because I'm sure more people have this problem and it would be nice to root out the source of it.
  15. Offline


    I have installed following plugins (on 1.4):
    xAuth (new)

    After installing the 1.4 version of the mc-server, I updated these plugins and added xAuth.
    Here is my GroupManager-Config (for both worlds):
        default: true
        - bonuses.*
        - creaturebox.dropspawner
        - creaturebox.placespawner
        - deathtpplus.*
        - essentials.depth
        - essentials.help
        - essentials.motd
        - essentials.rules
        - essentials.sign.disposal.use
        - essentials.sign.heal.use
        - essentials.tpa
        - essentials.tpaccept
        - essentials.tpdeny
        - essentials.who
        - iConomy.list
        inheritance: []
          prefix: ''
          build: true
          suffix: ''
        default: false
        - essentials.ban
        - essentials.clearinventory
        - essentials.heal
        - essentials.kick
        - essentials.kill
        - essentials.unban
        - trusted
          prefix: ''
          build: true
          suffix: ''
        default: false
        - containerprotect.*
        - creaturebox.*
        - essentials.gc
        - essentials.sign.*
        - essentials.spawnmob
        - groupmanager.*
        - iConomy.admin.grant
        - moderator
          prefix: ''
          build: true
          suffix: ''
        default: false
        - containerprotect.use
        - essentials.sign.protection.uses
        - iConomy.payment
        - default
          prefix: ''
          build: true
          suffix: ''
  16. Offline


    ^ I would check this one first. If I'm not mistaken, Essentials has a protection system based on placing signs next to the chests, and if there's no sign then the chest is considered unprotected. If written properly, those two protection schemes should be able to live side by side peacefully allowing players to choose. If written poorly, one may cancel the other.

    Try a test server with the exact same setup except Essentials to see if this is indeed the problem. If so, nag the author and see if that feature can be fixed.
  17. Offline

    Andrew Hoos


    I am a server admin running a craftbukkit 670 with the minecraft 1.4_01 client. I like your pluggin alot. I tried to remove the logging, but it persisted. Thank you for any help you can provide.

    Here is my yml file

            default: true
                prefix: ''
                suffix: ''
                build: true
                - 'containerprotect.use'
                - 'containerprotect.no-log-permit'
                - 'containerprotect.no-log-deny'
            default: false
                prefix: ''
                suffix: ''
                build: true
                - Default
            default: false
                prefix: ''
                suffix: ''
                build: true
                - '*'
            group: Admins
  18. Offline


    You are certain you replaced ContainerProtect.jar with the new 1.07 version? Let me run a quick test when I get back home today. Maybe I uploaded the wrong file or something :-P

    Update: *scratches head*... nope, the file is good and I've just double-checked the new options on my production server without any issues. I really can't say what's going on :-/
  19. Offline


    how can i set the default mode to /cp 2 ???
  20. Offline


    Short answer: You can't. The plugin does not currently keep mode information per player across sessions. I may add this feature if sufficiently motivated ;-)
  21. Offline


    Sure thing... ive got a copy of the paris hiltons sex tape?
  22. Offline


    I have just posted an important update, version 1.08, which fixes a pretty stupid exploit. In previous versions, any player with build access could bypass protection on a single chest by placing a second (unprotected) chest adjacent to the protected one. ContainerProtect will now stop you from placing a chest next to one that you do not have access to.
  23. Offline


    I have the same problem :(
  24. Offline


    Version 1.09 posted. See if this one works better, I think I goofed :-P
  25. Offline


    Floyd, this plugin is EXACTLY what I was looking for on my server. Thank you so much for taking the time to put this together, the integration with Permissions is just perfect. Thank you!! =)
  26. Offline


    I'm just curious, would it be possible to add some sort of chest modify command? I'm contemplating moving to this from LWC, my players are a little annoyed about having to remake all of the chests that they've already locked using LWC though.

  27. Offline


    Yes, this is a much needed feature and it should be fairly easy to do.
  28. Offline


    can you add a config file with changeable default protection status?
  29. Offline


    Would it be possible to have it make a log file of every instance that a user uses a container of some sort and give the coordinates of the container accessed and the time of day (IRL time, not in game time) that it happened at?

    Basically make it like locations.txt, but add a little more info to it. Would that be possible? :D
  30. Offline


    Is this working with 766?
  31. Offline


    seem to work fine with 818 :D

Share This Page