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.
Will try to add per region blacklists and another 2 feedback mode that would not show the re-spawn time, perhaps with part of the phrase taken from the config file so it's more custom.. will have to think about what would work better.
Again, thanks a lot for this. Awesome plugin.
The plugin is working great, thanks! I would love to see per-regions blacklists at some point :P
@Crayder
-.- ok lol
@Raidendex
Thanks so much dude! About this though: "Message contains the number of seconds that block will be restored in as well."
Not so good for mines rich in diamonds. Any way we can configure it to NOT show the regen rate?
Added blacklist option. Use IDs from here http://www.minecraftwiki.net/images/8/8c/DataValuesBeta.png to blacklist those blocks. Blacklisted blocks will be basically ignored if they are destroyed or placed within a region. Atm it's one blacklist for the whole server. I may change it to per region basis later on. Again file is just uploaded version 2.6 it will take some time before it shows up here.
@In5aN1aC
its not approved yet, takes at least couple of hours after I upload something
The latest version I downloaded still has the green text for OP's in it as far as I can see.....
@Crayder
Again I'm not too sure if it would look good for certain blocks to regen or not to regen, might in the end look bad :) plus sounds like too much extra work ;P
Anyways uploaded a new version, no more green chat for OPs and added /rb region feedback command. Basically setting it to 1 will warn player every time they place a block, setting it to 2 will warn player on either place or destroy. Message contains the number of seconds that block will be restored in as well.
Try it out see if it works out.
Btw in general any actual issues so far?
I know few sort of bugs - beds, doors type things won't regen well since they are made out of two blocks so you might get half a bed or something lol, don't really recall what happens to stuff like signs, buttons, switches might be glitchy too, but i don't care much for any of those items so I didn't handle in any way :)
@Raidendex Awesome man, could you make it so we could customize the message in the config? If not, I think something like, "You are placing blocks in an area that is set to be regenerated. Please be advised that anything you build will be rolled back."
I kind of like the green text, but was unsure what caused it. Maybe you can also make that a config option, a boolean?
Had one more suggestion: "blocksToRegen" made me consider, do you think it'd be possible to add a blocks whitelist or blacklist, something in the config where you can optionally list certain block IDs. If using the whitelist, ONLY those blocks will regen in the area. If using a blacklist, ONLY those blocks won't? Just throwing out ideas for you. Awesome plugin again, saves me a ton of work.
@Crayder
Ok, I'll try to work on that today. Message per placing would be easier to do
As far as green text, it's just a little plugin in a plugin, can easily remove it. I just use it on my server :) if youre OP text will be green, if you're op and raidendex text will be colors like a rainbow lol. I'll remove it along with the notice feature.
@Marcus101RR I noticed this also! All op'd players have green text after this plugin. Any fix?
I mentioned once before but I don't think you saw it: Think you can create a config property to allow us to disable players from placing blocks in region'd areas? I ask because there's no way for players to know that the area they are in could be regenerated/rolled back. That, or could you add the option to send a message to players when they place a block or enter a region'd area, informing them?
Thanks a ton for this awesome plugin.
I'm having green text since this plugin...and we fix that to not do that?A
Also if anyone wants to change something in the code for whatever reason, JAR file contains the source files.
@Crayder
You really shouldn't be editing yaml file yourself. All can be done through the plugin.
blocksToRegen is just a field where the current block that are in queue are saved in case the server crashes, not really a setting to worry about.
Reload config file should be easy enough to add for the region settings editing, I'll just need to make sure that won't cause any issues.
.... well added it /rb reload, will reload the yaml file, but before that it will first restore all pending blocks. Probably would be fine without it, but just in case reload breaks anything. I would still advise changing things through the plugin itself not manually in the config file as yaml is very picky about spaces etc and one wrong thing can break everything :)
Also, what about "blocksToRegen"? If left empty, all will be regenerated? If entering block IDs, only those? Can you give me an example of proper use?
@Raidendex Cool, thanks. What about the possibility of adding a plugin reload command? I was just editting the YAML file directly to change some Y coordinates and noticed there was no way to essentially load these new coordinates.
@kahlilnc
I think it would be easier to have a separate plugin that randomly changes blocks in the same area. RegenBlock would not be aware of that kind of events so it would still do it's job. I just think it would take quite a bit of change to add this functionality, but I can look into it.
@Crayder
When block is destroyed or placed within a region information about it is saved to the yaml file in case server crashes as well as it is added to a internal plugin queue. Then once a second if there are any players on the server plugin will check re-spawn time of each block that needs to be re-spawned against server clock. If time when to re-spawn is smaller than the server clock, block is restored. As far as ram i guess each block in the queue is a small object with couple properties about it like location, type, data, re-spawn time. As far as server shut down, start, crash - on plugin disable or enable all the blocks are restored, this should work out well in most cases unless your re-spawn times are really long and server reboots/crashes during those periods of time.
What's the RAM usage like on this? Would higher respawn times cause more lag? Would server reboots/reloads roll back the respawn times?