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.
@Acer_Mortem
/rb sync [0/1] - sets region to regenerate all at once or not, 0 for not, 1 for yes.
@firefromthevoid
It does not work with 2 block objects well atm. I might add ability to re-spawn that eventually. For now try to stay away from weird objects in the regions.
It doesn`t seem to want to respawn doors, is this a known problem or just me?
@Acer_Mortem
Or possibly set it on a distinct timer and not from when a block is broken?
Is there any way you can set it so that the ENITRE region respawns and not just a single block?
Thank you so very much for all your help on the regen block/ other drop issues!!
@ZariusT
I did it that way so it would not depend on the actual block state in the world at that moment. Like if it was set to air already etc. And the boolean I need for the feature someone asked for that can ignore either block place or break events, not super useful, but it's there now so.
@Raidendex
Cool :) Yeah, I don't even listen to block place events. Thanks for the update, but would it perhaps be better (for compatibility with older versions) to keep the format the same and simply extract the info from the Block that's passed - eg.
I don't mind either way though, so thanks again for the update and update OtherDrops when you release a new build, if need be.
@Raidendex Starting with version 5.4
Method available directly from RegenBlock class.
@ZariusT
Ok moved some things around to include all check in this method.
So pass in location, material it should restore to, data for that material (for wool etc), player, and true for BlockBreakEvent. Would be false for BlockPlaceEvent, but I don't think you're using that one.
@ZariusT
That might work, but would need few adjustments possibly to fully function correctly.
@Raidendex
Thanks for the reply. The priority of OtherDrops will make no difference as MONITOR is the highest (latest) priority so I can't set OtherDrops to occur after RB (it might run first, but no guarantees for plugins at the same priority level).
OtherDrops needs to be HIGHEST for BlockBreak due to Regios being at HIGHEST and WorldGuard at HIGH - same as RB I need to make sure OtherDrops runs after the protection plugins to allow them to cancel the event if needed.
As mentioned this issue applies to any plugins that replace drops so a server admin that wants to replace blocks and use RB is going to have issues regardless.
Having said all this I've successfully integrated RegenBlock support into OtherDrops (since I can see that the BlockBreakEvent in RB just called .regenBlock(block, material, player) and it's luckily a public method :)).
I would prefer to not have so many dependencies but the only way I see to fix that is for Bukkit to add a BlockBreakEvent.getDrops() function that would allow you to clear the drops without cancelling the event. If you (or anyone else) are interested in this please comment and/or vote on the issue at the Bukkit bug tracker here.
I think having an api will really help (especially in the long run) I know I personally really need this plugin and otherdrops to work together for my server to run (unless I can find away to makeshift my own) but I understand if its to much work atm.
@ZariusT
Adding API is possible eventually, but that's just more work for both of us.
This works fine. I imagine the only reason is the different priority. I believe otherdrops grabs event at HIGHEST priority, which is probably is not needed, but maybe you have reasons for that.
RB grabs events as MONITOR, letting different region protection plugins to kick in and cancel the event before it.
I expected to see some sort of 50/50 chance of RB working with this as both plugins looked at block break event as monitor, but it worked 100% with few hundred blocks that I've smashed, so either scheduler liked me and gave event to RB first or it works.
@Raidendex
Hi, thanks for looking into this. The default is to replace as that's the most common use of OtherDrops, but OtherDrops allows for both adding new drops and/or replacing default. If they are just adding new drops then the event is not cancelled. Unfortunately, and this applies to any block drops replacement plugin, the only way to cancel default drops is to cancel the event, set block to air and drop the new stuff.
This causes problems with logging plugins too. I've supported a few of the major ones by using their API to report the block break. Do you think this would be possible with Regenblock? Something like regenblock.regen(location) or .triggerBlockBreak(block)?
@Akitsaws
Just tried otherdrops with their default includes and breaking glass.
It looks like by the time RB catches the event, block type is set to air, so they are not allowing blocks to break normally and overwriting event's values which messes up what RB can do.
Maybe ask them see if they can do something different.
@Akitsaws
Well if they are changing the block break event before it gets to regenblock it would mess it up. Don't see why they would need to really unless they are removing default drops and replacing with others instead of just adding more which would be very simple. I can't really do much about that. All Rb does is listen to block place and block break events mainly. And record block's data like type and location from those events while making sure it wasn't cancelled.
@Akitsaws
Oh that's why....
@Raidendex
any custom drops with it wont regenerate with this plugin it use to work during 1.3 I'm not sure which plugin change since that time. I do know that blocks replaced wont regen with your plugin maybe they change the blocks to air and thats why it wont regen anymore or if its just all custom blocks in general might have to do more testing. And otherdrops is basically the mother of all drop configuration plugins by far, you can do anything from simple drops, to commands, to baby mobs only on rainy days that play music
@Akitsaws
How so? Not familiar with that plugin.