ChestRestock
This plugin allows admin to set up chests that automatically restock based on configurable parameters. This will allow you to create special chests for a variety of situations. You could create a chest for people new to your server containing a set of starter gear that they can only loot once. Or make reward chests in dungeons where you don't have to worry about them being empty. All kinds of things are possible!
Features:
- Automatically-restocking chests
- Chests can either add to or replace their current stock
- Configurable restock period
- Can either be set to start timing based on the time a player last opened the chest or at fixed intervals
- Can be set to preserve the position of the items in the chest
- Restocking chests are indestructible by default
- Limit # of times a player may loot each chest
- Restock chest by command
- Full multi-world support
- Chest naming
- Unique properties per chest (for any of the chest properties)
- Global default settings for all chests and optionally world specific defaults
- NEW in 2.0 Option for chests to have unique inventories per player (No loot theft!)
- NEW in 2.0 Option for chests to redstock when they receive redstone power
- NEW in 2.0 Commands are more dynamic
- NEW in 2.0 Now works with ANY block based inventory (dispensers, crafting benches, etc)
- NEW in 2.1 Option for chest to broadcast a global message when it restocks
- NEW in 2.2 Randomized loot for chests!
- NEW in 2.3 Command to restock all chests or chests with specific names and/or in specific worlds
- NEW in 2.3 Ability to set all chests in a world to restock with what is currently inside of them (This is limited by default to NOT include newly created chests!)
Instructions
- Place ChestRestock.jar in your plugins folder.
- Start your server.
- Type while in game for a list of commands
/cr
- Or target a chest and type This will set up the chest with default settings (adjustable in config.yml) and will restock with the items currently in the chest.
/cr create
Permissions
All permissions are default: OP
- chestrestock.*: grants all permissions
- chestrestock.cmd.*: grants all command permissions
- chestrestock.cmd.<cmdname>: grants specific command permission
- chestrestock.break.*: allows breaking any chest
- chestrestock.break.<chestname>: allows breaking specific chest
- chestrestock.bypass.lootlimit.*: allows unlimited looting of any chest
- chestrestock.bypass.lootlimit.<chestname>: allows unlimited looting of specific chest
- chestrestock.cmd.*: grants all command permissions
Further Help
- Type /cr help for a list of commands.
- Type /cr set while targeting a chest you have initialized with /cr create to see a list of properties you can set for it.
- Type /cr set <propertyname> to see a description of what the property does.
- Type /cr set <propertyname> <value> to set a value for a property.
- global_defaults.yml contains default chest settings for when a world does not have a specific default.
- defaults/<worldname>.yml contains default chest settings for specific worlds.
- If a default setting is missing for a world, the default in global_defaults.yml will be used.
- Loot Table Tutorial
IF YOU ARE HAVING LOOT TABLE PROBLEMS
First, go here: http://yaml-online-parser.appspot.com/
Paste your loot table file into the left-hand box. If it says you have problems in the right-hand box, this is why it doesn't work for ChestRestock.
Yaml is a very particular file format and it doesn't like when you don't enter things correctly. Read a tutorial.
Hey is there a way to just make every chest refill instead of selecting each chest? and also how can i set it to where the chest at spawn refill with better items like 1 diamond maybe some armor. Please reply soon thank you
@dastompa
Indentation matters a lot in yaml... Should be more like this: http://pastie.org/4338617
http://pastie.org/pastes/4338605/text
there you are sir
@dastompa
Please repaste this on http://pastie.org/
Thanks dump, I'm getting spawns now
One more issue and i'll be out of your hair
below is part of my loot table, however the table appears to be ONLY choosing the last item in the list for some reason, ive restocked my chests over a hundred times, and the last item is the only one of the 4 that will spawn in the chest, any idea why?
@dastompa
They do not use the same yaml setup.
Hey dump, having a small issue
I'm using the guns+ mod (unrelated) and yours together, and cannot seem to get the id's into a loot table properly
For example if I put one item in a chest, and save the chest, I get the following item id in the yml: 0:t:318;d:1037
I can't seem to get this to work via loot table, ive tried 318;1037 and every combination thereof I can think of, no dice
I'm sure its something simple, thanks :P
@Wreyth
Okay, fix it in #65, sorry for the delay, haven't had a lot of time to do any kind of thorough testing. http://ci.onarandombox.com/job/ChestRestock/65/
soooo any update on the chests restocking with every /reload or server restart yet? i have some really rich players around the server right now because of it
@dumptruckman
Oh my apologies, should have thought that! Thanks.
@JoeBl
There is a bypass permission.. so make sure it's not some op testing this before you think it's a bug. Read about the permissions above.
@dumptruckman
Thanks, that helped. But now I seem to have an issue where the player limit means nothing, it just keeps on restocking;
@twisterlj
You must set the property "redstone" to true.
Curious if there is a way to get this to work with a dispenser using a button... The only way it seems to work is if the player accesses the dispenser and takes the item out. If they use a button to get the item/s out, it doesn't seem to register it.
@JoeBl
With a period of 0 it will never restock, do you want it to restock immediately? I think you'd have to set it to 1 for that (which isn't quite immediate, sorry). The reason why items dropped out is because they're in the chests physical inventory but not in the unique virtual inventory. When a player open's a unique chest, they open a virtual inventory that only they can see.
It just doesn't seem to work for me at all. I put down a chest, place some items in it, and /cr create, take the items and it doesn't restock. My global_defaults.yml:
Edit Strange this is, if I destroy the chest, the items drop out of it as if they were in there.. but they are not appearing in its inventory. Why?
@dumptruckman
Figured as much.
I've created a dungeon for players with adventure mode, and at the end of the dungeon is a cr chest - they receive items and that's it. It is set to period = 0, but to leave the dungeon (and "complete" it) they have to press a button which drops them into the entrance (pistons). Along the drop path I've set up a pressure plate they are forced onto that connects to the chest, resetting it when they leave. This way they cannot just push the button to initiate the pistons moving but not go with them and get the new reset loot.
My only concern is for multiplayer dungeons, one party can go ahead and leave while the other party(ies) can sit back and collect new loot.
@HeroLief
A small connection plugin could be made to make this happen. But there is nothing built in to ChestRestock for it.
@dumptruckman
Is there any way then to make the chest restock when a player enters a certain region?
@Wreyth
Thanks, I'll see if I can reproduce and fix.
@HeroLief
No, this is basically impossible in minecraft. A redstone signal does not have any player data associated with it. It could be attempted and may work in some cases but more than likely it would be a waste of time and end up extremely buggy.