RegenBlock
Part of the Minds of Chimera Project (dev)
CodeBlocks | MOCPlaytimeTracker | MOCDBLib | RegenBlock | MOCGoodEats | MOC3DImporter | ImageImport | MOCKiosk | MOCRater | MOCFizziks | GravitySheep | MOCChemistry | MOCRegistry
RegenBlock allows a creation of regions within Minecraft worlds that have a certain re-spawn timer assigned to them. Once a block in the region is destroyed by a player or a new block is placed it will regenerate to the old state after the timer is up.
Example uses
Regeneration of natural resources in certain areas, resetting of region to an earlier state - in a tutorial area on my server, there is a broken bridge that has to be repaired by the player, but after the player does so the bridge would normally remain fixed for the next player that does the tutorial, with RegenBlock I am able to "regenerate" old broken bridge. Can be possibly used as anti-griefing to some degree, but it will only check events associated with played placing or destroying blocks, not tnt, lava fire etc.
Permissions
regenblock.self - all or nothing permission for the use of any commands
Commands
(all at op level)
- Selection
- /rb select (ex,ey,ez) - Starts/stops player's selection mode. ex/ey/ez will expand selection in that direction. Y is vertical.
- /rb listselection - Lists player's current selection points.
- Editor
- /rb edit - Puts you into editor mode that allows you to change blocks in a region without triggering the re-spawn.
- Info
- /rb info - Print out information about the region in front of the character
- /rb list - lists all regions
- Global Blacklist
- /rb blacklist add/remove (id id id ...) - adds/removes supplied block IDs. Blacklisted blocks will be ignored by the plugin and not regenerated.
- Reload
- /rb reload - Reloads the configuration file. Use this if you updated regions through config.yml and have to reload it.
- Region management
- /rb create (name) [re-spawn time] - Creates a region based on your selection from /rb select
- /rb remove (name) - removes region from the list
- /rb type [typeId] - sets region type, 0 for normal, 1 for mine. Mine will regenerate only upwards and with random blocks that you specify with /rb spawnblock
- /rb sync [0/1/2/3] - sets region to regenerate all at once or not, 0 - normal operation, 1 - all blocks re-spawn at once based on first block broken, 2 - same as 1, but based on last block broken, 3 - blocks re-spawn in normal order, but shifted in time based on last block broken.
- /rb modify (name) [re-spawn time] - modify existing region
- /rb modify time (name) (re-spawn time) - modify existing region's re-spawn time
- /rb alarm time/message/radius (name) (value)- changes the region's alarm settings. Alarm will go off before blocks are due for re-pop to warn players.
- /rb rblacklist (name) add/remove (id id id ...) - adds/removes supplied block IDs for region. Blacklist blocks for a specific region.
- /rb feedback (name) (type) - sets feedback type for the region. 0 - none, 1 - on place, 2 - on place/remove
- /rb feedback set (string) - sets string sent to player during region feedback. Use TIME to show re-spawn time.
- /rb spawnblock (name) - lists region's spawn blocks.
- /rb spawnblock add (name) [id chance id chance...] - adds new blocks with spawn chance. Chances do not need to add up to 100.
- /rb spawnblock remove (name) [id id id...] - removes blocks.
- /rb repop (name) - Re-spawns all blocks in a given region
API
Method available directly from RegenBlock class.
public void regenBlock(Location location, Material material, byte data, Player player, Boolean isBreakEvent) location - block's location material - what material block should be set to once restored data - data value for the restored block player - player that broke/placed the block isBreakEvent - test if this is a BlockBreak of BlockPlace event.
@Raidendex
seems not, i have tested my server only with regenblock -> everything works fine after a reboot. then i only enabled multiverse (has currently 7 worlds) and it does not work anymore + prints the exception.
is there a way to modify this delay for testing?
http://pastebin.com/mqLuSxK6
@tarkus80
Well I set a 10 second delay before my plugin re queues old blocks, hopefully that will be enough for MV to start up, was on my local server, but I only have 2 worlds and just a few plugins so not too sure if that's enough or not.
@tarkus80
yeah I just tried it and it happened with non default world. Imagine it's trying to access the world info before world is actually up and running, hmm.
@Raidendex
as an information for now, i can add the following:
before the restart it has worked well, maybe it is also some kind of incompability with another mod like "multiverse" which sets a custom worldname for the chat also
@tarkus80
String worldName = block.getLocation().getWorld().getName();
Is the line
can't be the block object, because there are few lines before that use it. So must be location or world hmm
I'll try to play around with it
@Raidendex
i have done a test, placed a 4 block region, breaked the 4 blocks and did a restart:
2012-08-27 17:04:09 [SEVERE] java.lang.NullPointerException 2012-08-27 17:04:09 [SEVERE] at net.dmg2.RegenBlock.RegenBlockQueue.run(RegenBlockQueue.java:68) 2012-08-27 17:04:09 [SEVERE] at java.lang.Thread.run(Thread.java:722)
and now also the /rp repop command is not working anymore
config.yml: http://pastebin.com/RW5KMfid blocks.yml: http://pastebin.com/QAbwYXPP
@tarkus80
check server log, reboot, make sure that small region does not overlap with another, like the giant whole world region you wanted, if you made that etc.
@Raidendex
i will try to do more tests. i have just created a region with 4 blocks and 20s respawn time but i will not regenerated anymore..sync is 0, type is 0, alarm is 0, and there is no air under the region.. really strange, it has worked on the weekend
@tarkus80
I'm not sure, in some region settings certain blocks check if there is non air block under them before they re-pop and they won't re-spawn even if the timer is up, until air under them is replaced. They will however only sit in that waiting state for a max of 24 hours.
But it could be something else. Do a more controlled experiment. create a cube of iron blocks or something, set re-spawn time to 5 minutes or something, destroy bunch and then before time is up reboot the server, see what happens. Try this on all types of regions.
I try to do things like this before I release to catch any bugs and as far as I know all should be working, but there is always room for more bugs.
@Raidendex
hmm strange, because i have checked the blocks.yml and there are blocks mentioned which respawntime was yesterday at about 13 o'clock and they dont get respawned yet.
@tarkus80
It writes each block to the config file and on restart reloads them to the queue from there, so timer should not be reset.
@Raidendex
thank you very much for your answer :)
another question: will the timer reseted after a server reboot? I have set one region to regenerate every 24 hours and restarted the server in the meanwhile, but the blocks get not regenerated until now.
outch.....in fact, despite the regen work in game my bukkit's console send me a long message of error, i send this as a ticket
@Raidendex
Ok thank for this well-explained answer, i will give a try thanks
also i think i can no include the struture of the mine in the regen but just the walls and behind them so the mine structure will be safe
i try again today and that worked well, but i still have the default block (1:80 , 14: 15 and 15:5) that are in the config when i reload bukkit....maybe i have to reload only regenblock instead of all bukkit?
it appear that i only can change the configuration of a region in game and not by editing the config file, i tested with a test region and all modifications made to the region settings were erase andgone back to the state of creation
but when i change setting in game the config file this time change -_-
also (sorry i must be very annoying >.<) i made a test area with respawn time to 20 and alarm to 10 with a 100 radius but despite the test area regen with new ores i have no alarm message in game, is it because i am op and got the permission?
@LeXouilleFr
Im not at home atm. So cant check your respawn blocks code. But as far as how plugin works - you break a block if it's in a region it is queued and respawned later. Just that one block.
Now if the region is sync. Blocks in that queue will repops at same time. Again only the blocks that were destroyed.
If the region is also type 2 or whatever mine is. Then for each block a dice will be rolled to figure out what it will be based of spawn blocks you specified
Finally if say torch is destroyed it will repop as torch or try to, unless its mine then it will repop as whatever random spawn block.
Air will always respawn as air if something is placed.
sorry for such a number of questions >.<, but i really dont want to make a mistake
I want to use this plugins for regen my server's mines with all types of ores every month. So when you said :"all blocks that are in need of respawning will do so at the same instead of one by one as they were destroyed." Do you mean that at the end of the countdown of my mine, your plugin will regen the ores to the same percentage of the config?
I would like to know if will overise my currently structure (torches and stairs)? or il will just regen what have changed since i established the area? but if I include my structure (build wtith wood and there is also air) does the regen will destroy them (as i do not include thoses blocs in the config)?
again i am sorry for asking maybe too many question
...and i have on my last post (i have edited) an other question
ok thanks you for this fast answer :D ...i have just edit my post so i have one more question please
@LeXouilleFr It's in seconds only.
Sync means that all blocks that are in need of respawning will do so at the same instead of one by one as they were destroyed.
hi thanks for this plugins looking really awesome and usefull I'm not new to plugins but i just want to know what is the time's unite in your plugins? secondes? or can we configure like writing " respawntime: 1 month" ? and also by writing in sync if the region regenerate all at once if no , does it mean like create a cube whith WorldEdit? and else if yes, does it regen gradually? Also when i want to change the defaultspawnblocks from:
thanks if you can answer me and i am sorry for my english i am French ><
@tarkus80
Well I could I suppose... but what you could do is create A region in that world, then once it's in the config.yml file, just edit the location values to something really big and really small to just create a giant region. then either /rb reload or restart server and it will work for the whole world.
Something like this
left:
X: -1000000
Y: 0
Z: -1000000
right:
X: 1000000
Y: 254
Z: 1000000
I'm not sure how good this will perform though, there may be some issues, like quite a few physics events are cancelled by the plugin for the regions, cancelling them for the whole world might be troublesome. Try it out and let me know how it works.