Plugin Request Silktouch chests keep items in them.

Discussion in 'Plugin Help/Development/Requests' started by TheMrJezza, Apr 21, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    TheMrJezza

    Suggested name: SilkChests

    What I want: Normally when you mine a chest all of the stuff falls out of it. But I would like players to have the ability to use silktouch when breaking chests so the stuff doesn't fall out. This would then let the chest be placed somewhere else with the stuff inside. I would like a permission so only some players who earn it can use it.

    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: silkchest.use

    When I'd like it by: Whenever possible
     
  2. Offline

    pie_flavor

    @TheMrJezza May I assume by your posting in the ' plugin alternatives' section you are using Spigot 1.8? If so it will be a LOT easier.
     
    TheMrJezza likes this.
  3. Offline

    TheMrJezza

    Last edited: Apr 21, 2015
  4. Offline

    pie_flavor

    @TheMrJezza All right. 1.8 has a special tag that says what it will contain when placed down. Hopefully Spigot 1.8 will work with that.
    EDIT: CraftBukkit works in strange ways... I couldn't find a way to get the NBT tag. Oh well.
    I can't run a server to test this, so please test and tell me what happens.
    I came up with a great way to do the storage - all the inventories are saved in a chests.yml file. They are linked to the item through a UUID, and get this - I hid the UUID in color codes in the lore of the item. I really hope this works, because that was a good idea if I do say so myself.
    SilkChests.jar
     
    Last edited: Apr 22, 2015
  5. Offline

    TheMrJezza

    @pie_flavor Okay, I'll test it and see.

    EDIT: It drops the chest and all of the stuff out of it but you can't pick up the chest. So I'm thinking maybe that the chest works but you can't pick it up and the stuff that falls out are dupes, but it depends on your code.

    Would you mind having another go at it?
     
    Last edited: Apr 22, 2015
  6. Offline

    pie_flavor

    @TheMrJezza Are there any errors in the console?
    Or maybe there's a character limit on item names. If that's the case, I don't know how else to store the inventory.
     
    Last edited: Apr 23, 2015
  7. Offline

    TheMrJezza

    @pie_flavor Nope no errors

    EDIT: I put the server in offline mode when I tested it (I didn't have an internet connection), does silkchest use UUID's?
    I'll test it now in online mode.

    EDIT: nope online mode doesn't work either
     
    Last edited: Apr 23, 2015
  8. Offline

    Agentleader1

    Last edited: Apr 23, 2015
  9. Offline

    TheMrJezza

    @Agentleader1 The chest breaks and then instantly places itself again in the same spot, nothing falls out of the chest, the chest simply won't break if you use anything with silktouch to break it. Thank you for trying though.
     
  10. @TheMrJezza This is a nice concept for a plugin, however the difficulty lies in trying to find a way to store the items which were in the chest and store it in the item's data, without it being erased on shutdown.

    I will make an attempt to see if I can tackle the task when I get back from school.
     
  11. Offline

    TheMrJezza

    How does the 'Pick Block' button do it? By default in minecraft while in creative if you hold down ctrl and press the middle mouse button while looking at a chest full of stuff it will give you a chest with the stuff inside it so it can be placed, it uses NBT data. I do understand it is a lot harder than that, but maybe for storing what's in the chest it can be a start?
     
  12. Offline

    Agentleader1

    Sorry, I got lazy in programming .-.
     
  13. @TheMrJezza And I have completed it :)
    Download it here: SilkChests.jar
    Just take note that it uses a bit of reflection to add the NBT item, so it should be version independent (tested on spigot 1.8-R01 snapshot)
     
  14. Offline

    pie_flavor

    @DJSkepter
     
  15. Offline

    TheMrJezza

    @DJSkepter I Tested it on spigot 1.8.3 and it works, but is there a way to make the chest drop where it is, so it behaves more like any other block when you break it?
     
Thread Status:
Not open for further replies.

Share This Page