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.
Please is there anyway possible to target all chests on the map with one command? PLEASE?
I get a severe Java error whenever this plugin is loaded onto my server. It randomly comes up after about 15-20 minutes of operation. It only started recently. What could be causing this?
2012-07-03 07:40:53 [SEVERE] Unexpected exception java.lang.StackOverflowError at net.minecraft.server.Container.a(Container.java:100) at net.minecraft.server.Container.clickItem(Container.java:135) at net.minecraft.server.Container.b(Container.java:232) at net.minecraft.server.Container.clickItem(Container.java:144) at net.minecraft.server.Container.b(Container.java:232) at net.minecraft.server.Container.clickItem(Container.java:144) at net.minecraft.server.Container.b(Container.java:232)
This will fill the console about 100-200 times until it lags out the server. Its odd because I have used this plugin before without any issues. What could it be?
Please someone tell me if works fine for R4 :)
@labouche10
Target the chest and type /cr disable that stops Chest Restock from using that chest... so it becomes a normal one again.
Otherwise if somebody (OP/Creative mode) destroy the chest, and put another one in that exact spot... it will still act as it did before...
Tested this many times xD Sorry to everybody else, I am still learning this xD
Hello, you should make it so you can restock the items using chest shop, because my server is medieval and I want it so there is only a certain amount of items you can buy per day in a shop... If this is possible i'd be so grateful. Thanks!
Hi, I am trying to make a loot_table, but am running into some difficulty:
I am wanting the chest to stock with 1 of 5 items that are enchanted.
I created a loot_table called bpyramidloot_table.yml
So far this is my code:
bpyramidloot_table:
'1':
chance: 0.2
id: 0:t:267;e: DAMAGE_ALL:2
'2':
chance: 0.2
id: 0:t:306;e: PROTECTION_PROJECTILE:2
'3':
chance: 0.2
id: 0:t:307;e: PROTECTION_ENVIRONMENTAL:2
'4':
chance: 0.2
id: 0:t:308;e: PROTECTION_EXPLOSIONS:2
'5':
chance: 0.2
id: 0:t:309;e:PROTECTION_FIRE:2
In the debug area, I get this:
2012-06-28 04:19:13 [INFO] [ChestRestock-Debug] Preparing to restock...
2012-06-28 04:19:13 [INFO] [ChestRestock-Debug] Missed 7 restock periods
2012-06-28 04:19:13 [INFO] [ChestRestock-Debug] Setting last restock for 'Azilgath' to 1340871553389
2012-06-28 04:19:13 [INFO] [ChestRestock-Debug] Clearing inventory before restock
2012-06-28 04:19:13 [INFO] [ChestRestock-Debug] Restocking org.bukkit.craftbukkit.inventory.CraftInventoryCustom@37d59927
2012-06-28 04:19:13 [INFO] [ChestRestock-Debug] Got cached table!
2012-06-28 04:19:13 [INFO] [ChestRestock-Debug] Adding loot table to inventory 1 times
2012-06-28 04:19:13 [INFO] [ChestRestock-Debug] Total weight of 'bpyramidloot_table': 0.0
2012-06-28 04:19:13 [INFO] [ChestRestock-Debug] Increasing loot count for 'Azilgath'
Any Ideas?
Can you implement a command that will issue /cr create to all chests loaded on the map? Please? I'll give you cookies.
this is an awesome plugin, and is a core part of my server. ty!
but I was wondering how I could put items such as red wool in a loot table. I've tried: 35:14 35,14 and 35@14.
can any one help?
edit:
after looking on how non-loot table chests read red wool I found that it was: 0:t:35;d:14 I tried that but it didn't work sadly :( [I also tried 35;14 and 35;d:14 but no luck]
edit again:
if this is a feature that doesn't exist then could it please be added, would be very much appreciated!
what is the command to remove a chest?
@dumptruckman
Thank you greatly I appreciate it! :D
@deathz0ne
You could try putting an RS-Nor Latch on the pressure plate that 'restocks' the chest, and the latch Resets when they step onto another pressure plate (In say a Travel Portal [travel portals plugin ftw]) So it only restocks 'once' when you hit the pressure plate walking into the room, and that plate is Reset when you step into the travel portal (if you dont use the travel portals plugin you could just make a small pitfall or something... :)
@pilgreenal
I find myself fixing my own retarded mistakes a lot, so you're not alone ^.^ and I agree SUPER A+ on this plugin! :D Thank you DumpTruckMan!
@dumptruckman
I knew I was being retarded somehow...
Thanks for clearing that up for me. Great job on this project, Super +A.
Please Help! I cant figure out how to apply a loot table to a chest. Thanks!
@pilgreenal
You need to set the 'unique' property to false. /cr set unique false while targeting said chest.
I might be lost here but is there any way to have the chest inventory/restocking apply to everyone instead of a player by player basis? I am trying to set timed loot chests in a pvp area but I don't want everyone to be able to get the items, just the first person to get to the chest every restock period.
Works on R4? i'm going to update my server, and thanks man for answers :)
@CubieX
You need to update, this has already been fixed. I'd recommend http://dev.bukkit.org/server-mods/chestrestock/files/12-2-3-snapshot-b23/ or if you want some newer stuff b49.
Yesterday we updated from 1.2.5 R3.0 to R4.0 and on startup we're getting a bunch of these errors: (they repeat several dozen times on startup)
<<code 2012-06-12 22:52:04 [INFO] [ChestRestock] Enabling ChestRestock v2.2.1 2012-06-12 22:52:13 [SEVERE] Error occurred while enabling ChestRestock v2.2.1 (Is it up to date?) java.lang.StackOverflowError at java.util.regex.Pattern$GroupTail.match(Unknown Source) at java.util.regex.Pattern$BranchConn.match(Unknown Source) at java.util.regex.Pattern$BmpCharProperty.match(Unknown Source) at java.util.regex.Pattern$Branch.match(Unknown Source) at java.util.regex.Pattern$GroupHead.match(Unknown Source) at java.util.regex.Pattern$Ques.match(Unknown Source) at java.util.regex.Pattern$Branch.match(Unknown Source) at java.util.regex.Pattern$GroupHead.match(Unknown Source) at java.util.regex.Pattern$Begin.match(Unknown Source) at java.util.regex.Matcher.match(Unknown Source) at java.util.regex.Matcher.matches(Unknown Source) at org.yaml.snakeyaml.resolver.Resolver.resolve(Resolver.java:130) at org.yaml.snakeyaml.composer.Composer.composeScalarNode(Composer.java:172) at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:156) at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:237) at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160) at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:237) at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160) at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:237) at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160) at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:123) at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:106) at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:121) at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480) at org.yaml.snakeyaml.Yaml.load(Yaml.java:399) at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:53) at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:138) at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:105) at org.bukkit.configuration.file.YamlConfiguration.loadConfiguration(YamlConfiguration.java:175) at com.dumptruckman.chestrestock.pluginbase.pluginbase.config.CommentedYamlConfiguration.load(CommentedYamlConfiguration.java:43) at com.dumptruckman.chestrestock.pluginbase.pluginbase.config.AbstractYamlConfig.<init>(AbstractYamlConfig.java:51) at com.dumptruckman.chestrestock.DefaultCRChest.<init>(DefaultCRChest.java:34) at com.dumptruckman.chestrestock.DefaultChestManager.loadChest(DefaultChestManager.java:162) at com.dumptruckman.chestrestock.DefaultChestManager.initPolling(DefaultChestManager.java:67) at com.dumptruckman.chestrestock.DefaultChestManager.<init>(DefaultChestManager.java:42) at com.dumptruckman.chestrestock.ChestRestockPlugin.getChestManager(ChestRestockPlugin.java:93) at com.dumptruckman.chestrestock.DefaultCRChest.<init>(DefaultCRChest.java:42) at com.dumptruckman.chestrestock.DefaultChestManager.loadChest(DefaultChestManager.java:162) at com.dumptruckman.chestrestock.DefaultChestManager.initPolling(DefaultChestManager.java:67) at com.dumptruckman.chestrestock.DefaultChestManager.<init>(DefaultChestManager.java:42) at <</code>>
@raom
Hmm, I am unable to reproduce the NPE as of build #49... Please make sure you updated properly as I specifically fixed an NPE in build #49 that sounds exactly like what you're reporting. If it still occurs please www.pastebin.com the error.
@Akam123
You probably need to make sure the unique setting is false.
@deathz0ne
Unforunately tracking who caused a redstone signal is nearly impossible (unless it's just 1 step away) and if it were doable, would be extremely difficult to accomplish correctly.
What I could consider doing is adding a player limit per X amount of time so that they can only loot it once per day or what have you.
@Mayhem777
You're right, it does need better documentation. I will write something up when I have a chance. Keep in mind you can do "/cr set <propertyname>" (note, no value specified) and it will give you a description of the property.
@TheLoneWolf85
I'll see what I can do about the dispenser issue.
@Wannabeuk
I can only imagine the issue here is you have something wrong with your loot table. I'll see if I can't add some kind of value checking to prevent this even in that case.
@Mayhem777
Currently forever though I'm considering adding some kind of time option to that so it can be per day or what have you.
@Kolnan @Mayhem777
Excellent idea, I'll see what I can do.
I want the award money feature too! :D
One question... can I award economy money? Also, I'd be interested in making a video to show this off for you since you don't have one yet?