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.
@TruDan97
It does nothing for preventing destruction or placement of blocks, only for their replacement.
Hi,
How can i set it to only allow certain blocks to be destroyed? I have a public sand pit area, and some of the region is grass, and i only want them to get the sand from it, is this possible?
Also, for a future version, could you hook into WorldEdit? It is easy to hook into (being a plugin dev) and it also gives you the features of shift, expand etc
@skeletons10
Just tested it, seems like it's working. Created a region set it to repop after 30 seconds, destroyed few blocks and shut down the server. Checked yml file, blocks were still in it, so on start up they were re-queued. Of course since it was only 30 sec repop time, by the time I was back in the game, blocks were respawned, so I kicked it up to 5 mins.
Tried both shutting down the server and just crashing it, when I came back online, blocks were not yet there (as they were still on timer) once the time was up they repoped just fine.
Did all this for both region type 0 and 1, as well as sync and not sync. Not sure what is going wrong on your side, but from at least this limited testing it seem to work in general.
As far as leave, I guess they decay? in that case my plugin would miss it. someone made a patch for it few pages back in comments. Also if you play around you will notice few other types of blocks not being restored properly, so I would just suggest staying away from structures like that for now.
Hey ive gotten the plugin working nice and fine but i seem to have a issue with leavs regenerating is this a common issue or what?
@skeletons10
Ok ill check it out as time permits. Last week of classes now and then finals next week, so might be bit busy.
@BFUSpEd same problem
With regards to server crashes, I've tested it and the blocks in queue do not respawn after restarting, tried it with both sync modes. I've had to re-paste the mine and reload the plugin each time manually to make it work. havnt tried waiting the 24 hours to see if the blocks come back but it definately does not come back within the time set in config.
@Raidendex
alright sounds good btw im going to make a video for my mining world ill send you a link to it when its done so you can take a look if you wish ether way thanks for the help
Surprised this has so few downloads. I'm going to use this for my rpg server... as natural mines and resources need to regenerate. :)
@IronPython
There shouldn't be any limits on re-spawn time. So set it as long as you want, it is in seconds though. Only time it will re-pop the block no matter what if it's been in the queue and its time expired over 24 hours ago, but for whatever reason the block is still sitting in queue. Just to clarify, that doesn't make max time 24 hours, just if something was supposed to be re-spawned 24+ hours ago, but wasn't it will be then.
As far as retaining blocks, if all goes well it writes down every block to the config.yml file that is in queue with all needed data. Then if you crash or restart it will re-add all blocks back to the queue. In fact if you look few comments earlier , that's where plugin crashed for BBFChaser for some reason, though it haven't done anything like that for me.
@BBFChaser
well this is the line that's throwing NullPointer I guess
Block block = this.plugin.getServer().getWorld(worldName).getBlockAt(x, y, z);
None of those throw that I dont think so ... maybe some bogus data is in there
Can you edit your config.yml under blocksToRegen:
Either delete that block completely or do this
blocksToRegen:
world: {}
looked at the last few pages to see if someone asked this and i plan to test it anyways but id like to know a few things i am making this for a mining world and i got all the settings right the only one i have questions about it the re-spawn time. whats the max time you can set it? im hoping to have it replace the blocks some time after the player is done mining which normally is hours at a time on my server. also dose the restart timer carry over on server restarts? my server restarts once a day at 4am (no ones on at that time normaly) and i just want to make sure that if someone is mining and the server restarts it will regen after the server starts back up its not a big deal if it does not it just would be nice if it can.
@Raidendex
2012-04-12 15:37:16 [INFO] [RegenBlock] Enabling RegenBlock vBeta 3.4
2012-04-12 15:37:16 [INFO] [RegenBlock] (Beta 3.4) Enabled. Good Day.
2012-04-12 15:37:17 [INFO] [RegenBlock] (Beta 3.4) Adding old blocks to regen queue.
2012-04-12 15:37:17 [SEVERE] Error occurred while enabling RegenBlock vBeta 3.4 (Is it up to date?)
java.lang.NullPointerException
at net.dmg2.RegenBlock.RegenBlockBlockListener.requeueOldBlocks(RegenBlockBlockListener.java:262)
at net.dmg2.RegenBlock.RegenBlock.onEnable(RegenBlock.java:58)
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:215)
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:336)
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:250)
at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:232)
at net.minecraft.server.MinecraftServer.t(MinecraftServer.java:371)
at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:358)
at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:187)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:422)
at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
@Raidendex
The server is running the latest craft bukkit the other day (I believe when the 3.4 release came out) the server crashed for no apparent reason the only thing I could tell in the console was that regenblock had a error (all it said was regenblock 3.3 had a error is it updated) which made me come check for an update so I installed the 3.4 and it's still not enabling because it says it's out of date.
Let me get a copy of the console and see if we can figure it out
@BBFChaser
what server version?
Just installed the 3.4 beta version and every time i start the server it says theres an error loading the plugin that maybe its outdated any input on this?
@mrcheesete0
/rb select
puts you into selection mode.
assuming this bases selections on worldedit, but I don’t see anything stating as such, so would like confirmation? How do you create a “selection” to make a regen area out of.
@Raidendex
Im setting up everything right and they work fine...but then it doesnt work with a reload/restart of my server.
@KCZerG
Well I didn't write it with crops in mind, so I imagine it wouldn't work too well for that. Not sure why anything would disappear on it's own, but respawning of some types of crops might be problematic as they need correct soil type under them etc. Think stuff like melon blocks should work though.
In general plugin detects either block destroyed or block placed and then either repops destroyed or changes to air on placed. It really doesn't check much where new block is placed for the most part. So if it's half a bed it will just place half a bed facing just some default direction :)
So I would stay away from areas that have weird things that take up two blocks or have to have some block to attach to etc.