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.
@Nekrage
This is intended behavior. Chests, by default, only restock when people open them. You can have them restock without player interaction by first changing the chest's "accept_poll" setting to true and then making sure "settings.restock_task_interval" in the config is set to an appropriate amount of time. Please do read the comments that are associated with that config setting as this could have adverse affects if used incorrectly.
@DumpTruckMan
Thx for the help, got it working.
I noticed one problem, the global message that gets sent out when the chest restocks does not actually get sent UNTIL a player opens the chest and confirms that it respawned. This makes the message feature rather pointless.
Is this a bug?
Also, if this could be fixed..would it be possible to have messages that play 30 minutes, 20 minutes, 10 minutes, and one final one when it does respawn?
Would it be possible to make custom made potions restock? So far every single time i've tried they just become either night vision potions or a regular potion without the added effects.
@Nekrage
If it is in a separate file named arena.yml in the loot_tables folder, remove the "arena:" part.
If it's in the loot_tables.yml then that needs to be there.
No matter what I do I always get an error saying could not locate loot table arena
@BR3T0N
I would encourage you to peruse the source code if you don't want to take my word for it.
If you mean the blocks in a chunk are literally deleted (changed to air) and not just that the chunk is failing to load on your client, then something very malicious must be causing this and I can assure you it is not ChestRestock. If it's not a malicious plugin then it is certainly something wrong with your Bukkit implementation.
If you mean the chunk is failing to load on your client, then there could be several reasons for this and while it could be distantly related to ChestRestock the likelyhood is very very low. Preventing chunks from loading requires hacking into CraftBukkit which you can very simply tell is not something ChestRestock does by checking the dependencies in the pom.xml which will plainly show only a Bukkit dependency and not CraftBukkit. Alternately, the issue could be due, once again, to a problem in your Bukkit implementation.
As to why you think it has to do with incorrect yaml in the loot table, I don't think there is any possible way this is related. Invalid yaml throws an exception and the exception is caught. End of story. Even if it wasn't, Craftbukkit basically catches all exceptions thrown by plugins so that those exception cannot cause the normal flow of server operations to be disturbed. And if somehow it did not do this, it would be very obvious and most likely do way more than simply cause chunks to not load.
If I had to guess, I'd say you're probably using some buggy dev build of CraftBukkit or some other Bukkit implementation which always seems to cause crazy issues like these.
Now, if you would kindly not accuse me anymore of such heinous activities without any kind of proof to back up your ridiculous statements, I would greatly appreciate it.
Thank you and have a good day!
@dumptruckman
I'm 100% sure it is. Only chunks of the map which contained chests managed by ChestRestock were deleted, other chunks which contained chests unmanaged by ChestRestock remain. Like I said, I think it has something to do with having an incorrect YML loot table, I'm asking if there is anything you can share about your plugin that could cause such a problem before I need to start poking around to find it myself.
@BR3T0N
Yes. It is 100% not ChestRestock causing this issue.
Hey, I love this plugin but I've come across a huge bug. Sometimes when I create a chest, and return to it, there is an entire chunk missing. I don't quite know the trigger to cause it, but I think it may have something to do with changing the loot table. Any insight you can offer me?
Using ChestRestock-2.3.1-SNAPSHOT
-BR3TON
@kodiacbear93
set the loot_limit of the chest to 1.
@sammyturbo123
this is what loot tables are for. read the documentation in the plugin folder. i'm currently working on a new version that will make creating loot tables a lot easier but it's going to be a ways down the road probably.
@planktoon1
I'm fairly sure Bukkit has not added support for this yet in ItemMeta but once they do it should simply work.
While i was making some custom armor with nbtedit i noticed the +MaxHealth attribute and propably other atributes disapear when using this plugin, is this something that can be fixed, or you are aware of. perhaps i just missed something i don't know.
@Pelihulluus
just put the guns in the chest and /cr create. the guns still act as guns when u loot it. works for me
like this plugin. but atm im looking for a plugin that refills a chest with random items. like this. once u loot it. after a period of time. u can loot it again. but i want the loot to be random. because i dont want people to find the good loot. then they know where it is. if u get what im saying :)
Can restock chests be configured to only have items once per player meaning EACH player can loot the chest one time.
@Pelihulluus
I believe this is what you're looking for:
https://github.com/Shampaggon/CrackShot/wiki/Frequently-Asked-Questions#wiki-flexibility
@Pelihulluus
If the guns utilize Bukkit's ItemMeta then they can be restocked with the latest beta. However, loot tables (for random loot) do not yet support ItemMeta.
Is this compatible with the Crackshot plugin? I would like to create chests that spawn guns randomly in them.
@dumptruckman
Oh okay. I think the only way to check a world for checks would be to check every block and see if it is a trap. If it is, then it would run, and if not, then it would move on to the next block. Thanks for explaining that, as it was a little unclear.
@Djimusic
Unfortunately it is next to impossible to locate all of the chests in a world. As such I had to think of an alternate solution.
This is the way auto_create works: When a world is set to auto_create: true, any time you find a chest in the world and OPEN it for the first time, it runs the code that sets up the chest for restocking. That means that if you use the "/cr check" command before opening the chest it will appear to not be set up. If you have auto_create_new: false then any time someone places a new chest, it will configure the chest as "disabled" to make sure that when it is opened for the first time it does not restock. If you have auto_create_new: true then it either doesn't set it to disabled so it can be "set up" once opened OR it will immediately set it up, i don't remember which.
Setting up all chests in a world to restock.
Hello, I have been following this plugin for a while and can never get it to do what I want it to do. I was trying to get it to work with restocking every chest/despenser in a world for a minigame server I am setting up, but even that seems to not be working. I really want this plugin to work.
I am trying to get it to automatically set up all of the chests to restock at the default rate. You said to set the default of auto_create to true and auto_create_new to true. I did this both globally and per world. I then tried to do /cr check and it still said it was not set up. I tried to set it up manually with /cr create and it worked, so Why does it not work with creating them all. Can you please just add a command to make it A LOT EASIER. Simply add /cr createall -world. This could create only the chests in the world but not that new ones that are placed in after until you run the command again. Thanks,
-Djimusic