Plugin category: MiscSuggested name: BlockSpawnA bit about me: A normal user, looking for a plugin that will complete my requests for my server. It seems simple enough, and shouldn't take much time.What I want: I want a plugin that allows me to set certain respawn times for certain blocks within a defined region. (Eg: iron ore respawns every 500 seconds. Stone respawns every 30 seconds) And can be changed in a config file or by command. Possibly used with WorldEdit regions? Ideas for commands: /bscreate (W.Eregion) (name of block) (time to respawn)/bsremove (W.Eregion) (name of block)W.E = World EditIdeas for permissions: Whatever you feel like making. Should have some permissions at least. Maybe:Bs.createBs.remove??? idk.Willing to pay up to: Unfortunately I have no money :\ I'm only 16 and I have no job.When I'd like it by: Whenever you feel fit to do so. :]Similar plugin requests: Plugins like this do exist, but they never get updated and I have asked the writers with no response.Devs who might be interested in this: Idk :\ EDIT: Updating this would be fine too :] https://github.com/Vynlar/BlockRespawn
Doing this by each individual block could cause a LOT of server load... However, to make the region reset any given block type on a set interval (eg. every iron ore in the region resets every 500 seconds, and every gold ore in the region resets every 1000 seconds), would be quite easy. I don't have the time to make this right now, but if any dev's want a point in the right direction for a very fast/efficient way to do this, hit me up and I'll explain. Edit: I also suggest you do a check if players are in the area before the "reset"... otherwise you'll end up trapping/possibly suffocating players .
Thanks, I didnt think about trapping them... My region i have is a simple layout of a quarry kind of thing. Ore's will respawn at different rates, and since it's only one block deep, players would have been pushed out of the block. Thanks for the input though
surely this could be done with logblock? maybe just by making a plugin that runs a command every so often? i dunno but i may look into it if i have time.
If either of you could make something like this, I would be SO HAPPY... I would actually cry with joy as it is the last and final plugin I need. And I've been looking for over 3 months D:
Well if logblock has an API someone could use that to get the location of the selected ores, and then respawn them at the configurable time. If it doesn't, then one could create their own compact log with binary file.
Performance wouldn't be too bad - you just need to track BLOCK_BREAK events and save the last 5 minutes worth of blocks broken. After 5 minutes (600 seconds) have passed you respawn the block (if not overridden by another block) and remove it from your list of blocks (obviously saving the list to file is important too, in case of server restarts/crashes.
I was hoping more like 3 hours because I was going to set Diamond to respawn in my quarry every 3 hours hahaha
Well, your example showed 500 seconds and 30 seconds 3 hours block break logging shouldn't be too bad either, unless I'm missing something. There are already plugins that log these events in a flatfile (ie. not a mysql database) and someone would just need to use a similar concept and add the respawning feature to it.
I just didnt want to calculate it all again hahaha and I hope someone is willing to do it. I'd love them forever.
My reference to performance was based on an individual reset time per block, which is what (at least to me) it seemed the OP was asking for. This is unnecessary overhead, easily doable, yes... but do this much over head for a few plugins, and it'll add up quickly. The concept is incredibly easy: Code:java HashMap<Vector, Integer> saveBlockId = new HashMap<Vector, Integer>();HashMap<Vector, Byte> saveBlockData = new HashMap<Vector, Byte>();Vector v = new Vector(e.getBlock().getLocation().getBlockX(), e.getBlock().getLocation().getBlockY(), e.getBlock().getLocation().getBlockZ()); if(!saveBlockId.containsKey(v)) { saveBlockId.put(v, e.getBlock().getTypeId()); saveBlockData.put(v, e.getBlock().getData()); } Then to restore: Code:java for(Vector v : saveBlockId.keySet()) { world.getBlockAt(v.toLocation(world)).setTypeId(saveBlockId.get(v)); world.getBlockAt(v.toLocation(world)).setData(saveBlockData.get(v)); } saveBlockId.clear(); saveBlockData.clear(); For larger regions, you can take this one step further and put the restore function into an asynch repeat, changing a set number of blocks per tick until complete.
One way to reduce the overhead might be to only allow multiples of a set time so that you still run just one repeating function.
How about we change it from per block, to block type? would that make it any easier? :] that would work for me too.
What romobomo is implying (I think) is that if you want it to be exactly 500 seconds from when the block was broken then you have to track a lot of different times (imagine someone breaking blocks every 5 seconds - it's more of a performance issue if you want them all to respawn exactly 500 seconds are they were broken). Better to have a single repeating task that checks if a minimum of 500 seconds has passed for a block and respawns it then (which means worst case scenario is 999 seconds until respawn).
Zarius Hit the nail on the head, thats exactly what I was referring to. Run a single asynch thread, and do your checks within (compare destoy time to run time, or system time if need be). I mean... could you immagine... a thread for EACH block destroyed? *shudders*
Well, there was a plugin that was called blockrespawn or something... but it never updates. This plugin was not region defined, but block defined. You'd select ONE block, give it a name, and set a time. so like "/Br diamond1 50000" and it would have that diamond block (diamond1) respond every 50000 seconds. That could be made too, if anyone so wishes. EDIT: I'm basically looking for something like THIS that is up to date. :]
If anyone wants to update it, here's the source: https://github.com/Vynlar/BlockRespawn (idk if that helps though) Anyone.....? Please? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
I took a quick look at that source, and as I expected, it creates a new thread for each block... this may be ok for (very) small scale, bit for anything else, I would strongly advise against it.
There's also this. I'm not sure about the policy of reviving dead plugins. I doubt it will work with 1.1-R5
Re-Written Im 99% sure you can revive it XD But just add his name in there some where on the thread. md_5 He has been inactive for longer then 2 months. . . :/ Md what do you say?
Maybe not exactly what you want, but extremely close if no one else can fill the job: http://dev.bukkit.org/server-mods/regenblock/