[plugin]Chest Protection 1.2

  • Chest Protection 1.2


    What does it do
    This plugin protects all new chests that are added to the world after this plugin has been installed
    this means other users cannot steel your stuff or smash your chest even if that chest is outside the protected zones
    you can also have the option to unlock the contents that's inside the chests


    The chest commands are


    /cp = help
    /cp lock id pincode= lock the chest contents, note this is the default setting
    /cp unlock id pincode = unlock the contents of the chest, note if your chest is inside a protected zone the contents will still be locked as before
    /cp add playername id pincode = adding players to a locked chest
    /cp delete playername id pincode = to remove a player from your chest
    /cp unprotect id pincode = to unprotect your chest


    Example 1 /cp unlock 12 1234 = chest contents with id 12 is now unlocked, note that the chest is still protected from been removed or smashed,
    Example 2 /cp add yahgiggle 12 1234 = adding yahgiggle to your chest 12 with pincode 1234 note 1234 is the defult pincode for the chest
    Example 3 /cp delete yahgiggle 12 1234 = removing yahgiggle from your chest


    Note: the user name has to be 100% the same as the in game username if yahgiggle is Yahgiggle then yahgiggle wont work


    also the pin code defult is 1234 i plan to let chest owners change this pin
    Only the chest owner can add and remove users


    All Server Admins can still smash any chest


    Please report any bugs, also note this plugin is still at version one more stuff will be added,


    Also there has been a new small server side update that non steam server owners may need to install for this plugin to work

    Files

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png

    Edited 10 times, last by yahgiggle ().

  • Bump to let you guys know i have updated this script


    you can now keep your chest locked but let some users use it by adding them to your chest


    to add a user type in chat /cp add username id 1234
    to remove a user type in chat /cp delete username id 1234


    my plan is to later use your pin to open the chest but an api update is needed for that.


    the script not only checks pin but also the owner, so this means added users still cannot add other users or anything else

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png
  • Small bug fix with admins not having any rights over chests in protected zones


    Now Server Admins are able to remove, delete or move items from any chest

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png
  • i could add an update that if you open a chest and no one owns it, it becomes yours and locked how's this idea ?

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png
  • hmm that way we can also claim the shack chests :D hahaha


    on a more serious note now, I think on a server that could be very very dangerous. Just imagine the owner uploading in and then someone going around claiming all the chests before the other players had a chance to log in and claim them. :/


    Could you maybe add a small scan in the OnEnable() method to register all existing chests and then cross reference with the area ownership database? and then of course all chests not in areas should be ignored.

  • hmm that way we can also claim the shack chests :D hahaha


    on a more serious note now, I think on a server that could be very very dangerous. Just imagine the owner uploading in and then someone going around claiming all the chests before the other players had a chance to log in and claim them. :/


    Could you maybe add a small scan in the OnEnable() method to register all existing chests and then cross reference with the area ownership database? and then of course all chests not in areas should be ignored.

    Actually, would it not be possible to query the existing "world database" to find the current owner of all chests, add them all as "locked" in the plugin database with the appropriate owners?

  • Actually, would it not be possible to query the existing "world database" to find the current owner of all chests, add them all as "locked" in the plugin database with the appropriate owners?

    the world database does not log the user who place the chest so there's no way of knowing who made it this is why I have made the plugin oO

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png
  • Ah, ok. Did not know that the world DB did not have the "Owner".


    I would NOT then:


    add an update that if you open a chest and no one owns it, it becomes yours

    As Minotorious mentioned, I would think unscrupulous players would go around claiming all the old chests they could find...


    I see two options, First what Minotorious said:


    Could you maybe add a small scan in the OnEnable() method to register all existing chests and then cross reference with the area ownership database? and then of course all chests not in areas should be ignored.


    OR...


    Just tell players that they should create new chests for there existing ones and move the contents of their old chest(s) to the new ones.


    As for claiming "shack/dungeon chests", we would be no worse off then the way we are now.

  • When you @yahgiggle say...


    /cp unlock id = unlock the contents of the chest, note if your chest is inside a protected zone the contents will still be locked as before

    Does this mean that there is no real way to make a "community chest" (unlocked) in a protected area that any player can access with out having to add all players individually? And still have the area/room and the chest itself protected?

  • Hmmm. I just tried doing a "/cp lock ID" for the ID of a chest that already exists in my SP world and got:


    java.lang.ArrayIndexOutofBoundsException: 4


    It appears if players start trying to lock existing chests, the plugin will throw an error. If you are not going to somehow add existing chests to the plugin DB, then you will need to handle the attempts to lock existing chests errors with a "You can not lock existing chests. Create a new chest and move contents..." type of message.



    I just tried "/cp lock ID" for a newly created chest that I had done a "/cp unlock ID" and got the same error.

  • thanks for the bug report ill patch them tonight

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png
  • random question but what would happen if I placed a chest through a blueprint? will the plugin recognise that I am placing a chest and mark me as owner or not?

  • random question but what would happen if I placed a chest through a blueprint? will the plugin recognise that I am placing a chest and mark me as owner or not?

    no the plugin only detects the chest as you place it down i use the PlayerPlaceObjectEvent this event is not used when placing blueprints that one use's the PlayerPlaceBlueprintEvent and ATM in this event i cannot see how to get the chest ids, maybe i can talk to red51 about how we can get the chest ids when placing a blueprint, its a good point and something worth looking at and maybe adding to the PlayerPlaceBlueprintEvent.

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png
  • Bump to let users know i have once more updated this plugin


    Thank you @Jon_miner for testing and reporting a bug :-D


    Also made some changes to the commands for locking and unlocking chests, it has always been my plan for the owner to use a pincode for this sort of option, at the moment the pin is 1234 but i will add an option for the owner to change there pincode


    the new command is much the same but now you add the pincode at the end.


    Like this


    /cp unlock 23 1234 or /cp lock 23 1234


    of cause later if you change your pincode it will be what ever you make it


    Please keep testing guys and reporting back all problems cheers

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png
  • Are you going to change the version from 1.1?


    @yahgiggle
    Would it be possible if you open a chest that you own to have it indicate whether it is currently locked our unlocked along with the ID?

    yes this is going to happen soon
    Also a plan is to show who owns it

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png
  • I just tried placing a blueprint and it appears that ChestProtection did recognize the chests. I got:


    placed chest IDXXXXXX now added to your Chest Ownership defalt (sp) pincode = 1234


    I'm not sure btw what/how the pin codes are to be used?

  • I just tried placing a blueprint and it appears that ChestProtection did recognize the chests. I got:


    placed chest IDXXXXXX now added to your Chest Ownership defalt (sp) pincode = 1234


    I'm not sure btw what/how the pin codes are to be used?

    Thats something i did not expect lol well its good it does work when placing blueprints, this saves me more coding lol


    the defult pincode is part of the protection its sets you as been the owner the users you add dont have a pincode so if they try to add other users or to unlock the chest it wont let them, but later on i want to add a pinpad that pops up when you goto open the chest, your then need to enter your pin before it opens, but ATM the API does not support OnChestOpenEvent i have taked to red about this and he said he will add that event on the next update for me :-D

    Yahgiggle Steam Signature, real name Deon Hamilton :thumbsup: Server @ ip 139.99.136.76:4255 Name (The Federation of territory) Unity :thumbsup:

    If at first your code does not work call it version 0.1 with the odd bug :thinking:

    My Own Website




    31245-logo-png

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!