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

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

  1. Offline

    FloydATC

    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.

    Features:

    • 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

    Changelog
    • 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...
    Version
    Installation:
    • Requires Permissions.jar (2.5.4 or compatible)
    • Download and copy to your "plugins" directory
    • Optionally create the directory "plugins/ContainerProtect
    Permissions:
    • '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
    Use:
    • '/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):
    Code:
    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:
    Code:
    perl convert.pl < lockedChests.txt > plugins/ContainerProtect/locations.txt
     
  2. Offline

    IIGoldII

    Nice plugin.
    I've actually been looking for a dispenser protect plugin.Any way you can limit the amount of times someone can use a dispenser withing a configurable amount of time?

    Like giving this message if someone has to wait more time before using the dispenser again:
    "Please wait another (amount of time left) minutes before using this dispenser again."

    Also,maybe adding iConomy support so where you would have to pay a certain amount of money to use a dispenser/furnace.

    Otherwise,Great plugin!


     
  3. Offline

    FloydATC

    Hmmm... This plugin doesn't actually pay any attention to (hook into) the dispenser shooting out items since this is triggered by powering the dispenser. ContainerPlugin only affects interacting directly with the dispenser as an inventory.

    I don't think it's feasible (or even possible) to trace who or what triggered that, since this could be the output of any redstone circuit and the only practical limit to their complexity is the memory available.
     
  4. Offline

    n4Ghost

    I ahve problems.

    I have protect an Chest for any Player on my Server with /cp 3
    Now i cant protect an Chest with /cp3 for me or another Player.

    It comes the message:
    Invalid mode
    /cp [1;2;3 <player> 4 <group>

    Thanks for help
     
  5. Offline

    FloydATC

    Not sure what's wrong here but "/cp 3" requires atleast one player name, e.g. "/cp 3 n4Ghost FloydATC"

    The plugin should respond with "[CP] Current mode=Players: n4Ghost FloydATC"

    Any containers placed in this mode will be accessible only to you and me. If this doesn't work for you, please post the exact command as you typed it.

    Update: This turned out to be an issue with v1.02
     
  6. Offline

    n4Ghost

    /cp 3 n4Ghost

    This is my player nick
    than comes the error

    it goes only the playernick i used first
    all other dont go
     
  7. Offline

    FloydATC

    Ahaa, I found the problem! I've posted an update (v1.03) which accepts uppercase letters...
    *facepalm*
     
  8. Offline

    n4Ghost

    the link is frong

    regexfilter.jar
     
  9. Offline

    FloydATC

    Oops! That's a cool plugin too though, you may want to check it out! :-D
    [MERGETIME="1299701866"][/MERGETIME]
    Just found another bug; players could (incorrectly) type "/cp 2 PlayerName", containers with this mode could only be accessed or destroyed by a player named "PlayerName PlayerName".
    Version 1.04 fixes this, but any chests already affected by this problem will have to be removed by an administrator with the appropriate permissions.
     
  10. Offline

    n4Ghost

    Now it works fine

    Thanks

    Ghost
     
  11. Offline

    Drakmyth

    Nice plugin. I was looking for a simple way to make chests private to the people that placed them and this works perfectly. A couple questions/suggestions though:

    1.) Make dispensers, chests, and furnaces configurable separately (i.e. have furnaces be public but chests be private)
    2.) Have an option to disable chat log. Having it say the current mode every time I open a container is a little annoying. As an addendum, have it only print a customizable string if a player tries to access a container they do not
    have permission to use.
    3.) Is the mode set per user or globally? In other words, if one person sets the mode to private, is the mode private for everyone?
    4.) Are dispensers & furnaces only private while things are in them or are they like chests and are private when they get put down? If the latter, perhaps allow an option for this?

    Ideally I was hoping to make all chests private to whomever placed them and all furnaces and dispensers either public or private while things were in them (preferably the second option) and to make all this completely transparent to the players. This plugin as-is gets me part of the way there, and a lot closer than any other chest protection plugin I've found.
     
  12. Offline

    Asura23

    Great and simple mode,...
    I was just curious, could you make it so player would be able to lock doors, levers and buttons..?
     
  13. Offline

    FloydATC

    @Drakmyth: ContainerProtect works a little different from what you may think; the mode you set doesn't actually affect anything until you place a chest, furnace or dispenser. The location of that container is then recorded along with that mode.

    Later on, you can change modes but the containers you already placed are not affected. This means all containers can be configured independently of eachother, so you can place public containers in public places and private ones in your own home, make all furnaces public while the chests are private or whatever you want.

    Whenever you access a container, the security mode of that container is shown as a reminder or verification so you know if your items will be safe or not. I could ofcourse tie this to an optional "inspection tool" like some other plugins but I fear this would make things even more confusing :)

    @Asura23: Yes, I suppose this would be very simple. The plugin currently keeps a hard-coded list of object IDs to watch, I'll test for doors, levers and buttons if I get the time and see if would work as expected. If it does, I guess it's time to make that list configurable.
     
  14. Offline

    monir

    i cant make it work for 531 when i place a chest out it stands cp currentmoce=public when i type in the cp commands nothing happens what am i doing wrong or is it just the 531 build?
     
  15. Offline

    FloydATC

    I'm running 531 myself and it works like a charm. Did you grant yourself access to the "/cp" command with "containerprotect.use"?
     
  16. Offline

    monir

    Now i maked it work with groupmanager but the thing is i dont uderstand how groupmanager works so god so im using phoneix 2.5.4 so is it compatible with phoneix ?
     
  17. Offline

    FloydATC

    Yes, that's what I use myself.
     
  18. Offline

    monir

    i use phoneix and build 531 and i get this
    and the plguin gets enabled but the kommands dont work

    [​IMG]
     
  19. Offline

    Peder Anda

    Dude it says permission denied when i try to change the mod :( wtf??
     
  20. Offline

    monir

    floyd please help what is wrong why do i get warnings with phoniex and not with groupmanager?
     
  21. Offline

    FloydATC

    I have no idea why this happens, sorry... There is no constructor so it's not possible for the plugin to register anything before it's enabled. Maybe the plugin file is damaged/corrupted somehow? Delete the plugin file and restart the server. Look for error messages. Then download the plugin again, restart the server. Make sure there are no old copies of ChestProtect still left around.

    You need to grant access to the "/cp" command as described in the OP.

    I have tested the plugin with all recommended builds up to and including #556, all with the newest Permissions.jar (currently 2.5.4) and I have a hard time imagining what could be causing the problem :-/
     
  22. Offline

    Dabbi

    I also get when i try on my server to type /cp 1 i get [CP] Permission Denied. , It would be amazing if you could teach me how to add permissions , like make a tutorial or something that would help me and my server alot! :)


    Now i got it working but i only can do the public :/
     
  23. Offline

    FloydATC

    This thread really isn't the place for a tutorial on using Permissions, GroupManager or any other compatible plugin. I'm sure such threads already exist. About the modes, what happens if you type "/cp 2"?
     
  24. Offline

    yas

    seems to not work with essentials. added containerprotect.use to the permissions but it still says "[CP] Permission denied". will use the essentials signs until the day you or them make it work together -.-
     
  25. Offline

    FloydATC

    Essentials has a "/cp" command too? If so, it needs to be disabled somehow.
     
  26. Offline

    yas

    you do not have to type any command in the game chat. you simply place a sign next to your chest and type [Protection]. bad thing about this is that if the ground under the sign is not protected, one can simply dig under it and make the sign pop out. I wanted to use containerprotect for projects outside of homes/protected areas without having to protect the area.
     
  27. Offline

    FloydATC

    OK so that shouldn't interfere with the command processing. I don't know why it doesn't work for you; all it takes is for Permissions to return TRUE when I check for 'containerprotect.use'...
     
  28. Offline

    Sacul

    Hi FloydATC.

    Thanks for making this plugin possible. Works like a charm, however, is there any change to update it to the latest recommended build?
     
  29. Offline

    FloydATC

    I haven't even had time to load it up and see what breaks, are you getting any useful error messages?

    Update: I've posted a new version 1.05 which works with #600. This version uses onPlayerInteract() instead of onBlockInteract() which was removed in #600. Unfortunately, this means it will probably break on earlier versions so please test carefully before deploying on a live server. As always. Just in case, I'm keeping a copy of 1.04 online. I'm guessing it will take a while until all plugins work with #600 :-/
     
  30. Offline

    Sacul

    Thanks for the quick reply! I'm gonna test it tomorrow :)
     

Share This Page