KLandHealer
Warning
Before, using this plugin make a backup of your world data. This plugin can modify large portions of the world and if you happen to have some rare problems or incompatibility you could lose your world data. If the plugin functions correctly for a while then it is safe to assume that it will not cause any kind of world corruption. But, because of the large scale regeneration this plugin is capable of doing take extra precaution when evaluating it for usage in your world.
Feedback (Yes, YOU! LOL.)
If you use this plugin and it does not work properly, you have any problems, or if you like it. Leave me a message to let me know! I can not improve something if I do not know what is wrong with it. Just drop a comment below OR drop me an e-mail at [email protected].
Tekkit Or Latest Bukkit
This plugin supports the latest Bukkit or the latest Tekkit server build. However, for the Tekkit build make sure you download the file with the -Tekkit on the end. For the lastest Bukkit download the latest file with out anything on the end.
Description
This plugin will regenerate terrain at a configurable speed, based on how much damage has been done, will entomb player made structures or player placed blocks, and supports any land protection system which is compatible with the Bukkit event system.
- It can be configured to produce block placement events, or to bypass by not generating block placement events.
- The percentage of chunk difference can be adjusted to prevent it from regenerating chunks that have barely been damaged.
This plugin with a default configuration will start disabled. You must either supply a configuration, or let the plugin load once which will create the default configuration. Then type into the console regen.toggle or shutdown the server and go in and edit the configuration file produced as klandhealer.cfg. If you type regen.toggle you still must edit the configuration file or else the next restart the plugin will read back in the configuration file with the enabled field set to false.
Problems
If you have a problem with the plugin just post a comment to this page or send me a private message and I will fix the problem. Also, any suggestions or improvements can be very helpful and are likely not hard to implement so leave a message.
Quick Demo
Install the plugin into your plugins directory. Then start (or restart) your server. Go somewhere and blow a hole or some holes into the ground. You need some damage since it has to meet the criteria for the damage threshold which of course is set fairly low by default anyway. Now, type this command into the server console regen.target world <X> <Z> where X and Z are replace those with the numbers you see when you press F3 in your client. Also, the world name should be changed from world to the name of the world you are in if different. Now, since the plugin will be disabled by default also type into the console regen.toggle. You should see the console note that the target was pulled and afterwards you should notice blocks start to appear in the hole you made roughly ever 3 to 5 seconds. You can speed this up by typing regen.totalblocks 1000. I have tested total blocks up to about 50000 on my own server, but that is pretty high. It takes roughly 60000 blocks to restore a chunk all the way from bedrock. If you do not see any blocks appearing then check the console for any exceptions/errors. Also, you might use the command regen.debug to enable debug messages and you can see how damaged the chunk is and make sure it is above 0.001.
Special Features Of The Regeneration
I consider these special features rather than shortcomings of the algorithm. However, at some time I would like for this plugin to handle this situations if the plugin user so desired.
- Player placed blocks are not changed.
This is a rather easy one to actually fix, but I like the idea of old remnants of player building being sort of entombed. Basically, any block that is already existing will not be removed or changed to another block. Only blocks that are AIR/WATER/OIL/LAVA will be changed to the original block which once occupied that block position.
- Most underground caves will not be regenerated. The visible surface will always be regenerated.
The way the algorithm works is very similar to rain. It starts at a random XZ over the chunk then it falls down and lands. Then it checks to see if it can slide off in the four major directions on the XZ plane. To be able to slide the adjacent block must be AIR/WATER/OIL/LAVA and the block below that must also be AIR/WATER/OIL/LAVA, and if so it drops down and the process repeats. This allows it to fill low areas first which keeps the chunks coming up fairly smooth with out spikes sticking up. Also, it will allow it to slide under and into caverns which it normally would not be able to fall directly down onto. It will however only slide on a single chunk and not across multiple chunks which means only he entrance to a player made caverns will likely be covered up but the cavity will remain intact.
Option To Not Generate Block Placement Event
If you configure it to bypass block placement events then it will ignore any other block protection plugins you have installed and enabled. This is likely not going to be desired and it is recommended not to enable this feature unless you have made a proper backup of your world data. I left this option because it is possible that this might be the desired behavior.
Percentage Of Chunk Damage
The percentage of chunk damage required is used to keep from regenerating chunks that are not damaged enough to trigger the threshold. This is configuration using a percentage. The damage to a chunk is calculated by:
- Original chunk is generated and cached.
- Original chunk is compared to current chunk block by block. If the current chunk contains a AIR block and the original chunk does not then the damaged block count will be incremented.
- The damaged block count is divided by the maximum number of blocks in a chunk which is (16 * 16 * 256) thus producing a percentage of damage.
It does not consider a block placed by a player or entity as a damaged block in the current chunk. This allows underground mines to be constructed which will not be regenerated unless some part of the chunk is visible from the sky. The algorithm which decides where to place the blocks is not straight forward and can slide blocks down into player created cave or entrances to underground volumes much the same way that water flows.
Configuration
These is an explanation of the configuration options and shows the default value.
- damaged-threshold: 0.001
This is how damaged a chunk must be before it will be regenerated at the pace set by blocks-per-regentick. This is in ratio form. So that 0.5 would be 50% and 0.05 would be 5%.
- blocks-per-regentick: 100
This is how many blocks are regenerated per regeneration tick. It takes roughly 4.75 seconds per regeneration tick, or 95 server ticks. The plugin makes other calculations during this time, but only actually performs the regeneration after 4.75 seconds or 95 server ticks to be more accurate. When a regeneration tick occurs this is how many blocks can be placed during this regeneration tick. For example, using the default value of 100, after 380 server ticks or 19 seconds a total of 400 blocks will have been regenerated at a maximum. There is no guarantee that each regeneration tick will regenerate this number of blocks, however this is more of a maximum to allow you to control the speed of regeneration.
A chunk is selected at random and tested to meet regeneration percentage threshold, each 95 server ticks (4.75 seconds).
- max-regen-per-chunk: 100
The blocks-per-regentick or the command regen.totalblocks set the total number of blocks that can be regenerated per single cycle. This total number of blocks is split between all chunks on the backlog by how damaged that chunk is. For instance if the backlog contained 5 chunks such as damaged as follows 2% 80% 3% 5% 5% and blocks-per-regentick was set to 100 then the maximum number of blocks that can be regenerated per chunk is as follows in this exact order 2, 84, 3, 5, 5. This is because let A equal .02+.8+.03+.05+.05 which is a total sum of .95 now the chunk damaged only 2% gets this many blocks to regenerated at a maximum 0.02 / 0.95 * 100 which equals 2. This allows the most damaged chunks to regenerate fast and the less damaged chunks to be regenerated slower. This option also essentially allows to to specify more total blocks with out causing a single chunk to regenerate abnormally fast. For example if you set blocks-per-regentick to 40000 then a whole chunk would be regenerated in 8 seconds which is very fast, but if this option max-regen-per-chunk is set to 100 then a single chunk could only regenerate 100 blocks at maximum instead of 40000.
- enabled: false
This will disable or enable the plugin. By default it is disabled and you are forced to enable it. This is to prevent you from losing data because you did not have the plugin configured correctly and it regenerated terrain that it was not intended to regenerate.
- bypass-event-place: false
If set to true this will cause the plugin to bypass all land protection plugins which use the block placement event. It will not bypass a faction system that has been successfully interfaced using the factions-java-class-name option below.
- backlog 40
This is how many chunks to keep a handle to. For example when a randomly selected chunk matches the damage percentage threshold an attempt will be made to place it on the list of chunks. For it to be placed on the list of chunks it must have more damage than one or more chunks already in the list. By default the list has a length of 40. The larger the list the more smooth the regeneration of land will be across all damaged chunks. After, a long period of testing it has become obvious that a more realistic value such as a few hundred will give better performance especially if you have a lot of world damage for example from nukes. This is because only chunks loaded into memory are evaluated. So as a player moves across these damaged regions and the algorithm happens to select a chunk or a few from this area it can have a better chance of holding these in memory to be worked on during each cycle instead of being limited to just 40 chunks this higher number here also of course produces a smoother regeneration over a larger area which is good too.
- world-list
world-list: - world - world_nether
By default the worlds the plugin will operate on are the default world and the default world_nether. You can change which worlds are operated on using this option.
Basic Configuration
max-regen-per-chunk: 100 damaged-threshold: 0.01 blocks-per-regentick: 2000 enabled: false bypass-event-place: false world-list: - world - world_nether backlog: 1000
Commands
These commands were intended to be executable by anyone with OP privilege or from the console, but in the latest release there is a bug that makes them runnable only from the console. Also, a harmless error will be produced in the form of an exception.
- regen.totalblocks <count>
This adjust the same value pulled from the configuration. This is the total number of potential block places that is distributed among all the chunks proportional to their damage ratios. The higher this number the faster the world regenerates, and the lower the slower.
- regen.toggle
This will disable and enable the plugin from running. Due to the latest build having a bug you might not easily be able to tell if it is enabled or disabled.
- regen.target <world-name> <x> <z>
This will make the next chunk to be selected to be the chunk represented by the coordinates in the world specified. For example the default world with client coordinates 342 128 could be selected using: regen.target world 342 128
- regen.debug
This will toggle the debugging output on or off.
Is this plugin no longer being updated, or abandoned? I could really use something like this for my server, but I'm running 1.5.2 and its apparently not working with 1.5.2. Has anyone else used the source code to update it?
I am extremely interested in this plugin, particularly for 1.5.2 (and beyond). Will there be any coming support or updates? If not I would really appreciate if you would be willing to supply me with the source code. I have been wanting something like this for a long time and its been the main reason I haven't started a public server. I would love to work on this to make it work with newer versions of mc/bukkit and add features as well. Please contact me kmguire3413!!!
Can you please please please update to 1.5.2!
source code inside JAR for all my bukkit projects
damn this plugin is just what i need, but it seems to be not updated anymore
can i maybe get the source code?
If anyone wants this updated to the latest version let me know. It may work fine with the latest version of Bukkit. But, if not and you want this plugin then send me a private message and let me know. It will not take long to update it.
@iKrzysiek
Yes, it should work with terrain control. Okay, as soon as I get a chance I will test it against the latest Bukkit version and release it.
Ok, i will try it when you make update for 1.4.2 minecraft. Will it work with TerrainControl?
I do not know if only Tekkit server is effected by this bug. But, sometimes stone is converted into gravel or dirt even on protected land (protected by WorldGuard, Factions, ..). How frequent it happens depends on a variety of factors and also the fact that most players do not build much with stone.
But, if anyone has noticed this bug please report it and also tell if you are using Bukkit, Tekkit, or anything else.
@iKrzysiek
It should already support Factions and WorldGuard. When it modifies a block it does so using the name [KLandHealer] so therefore Factions and WorldGuard should block it from making changes.
However! There do exist a strange bug that can modify small parts of protected regions. I am currently working to squash this. It only does strange things like turn stone into gravel or dirt.
So this plugin is still stuck as Beta until I can fix that, but you may not be experiencing these kinds of problems?
Could you add a Factions and WorldGuard support? That WorldGuard regions And Factions claims wont be regenerated.
@USM666
Yep, I had it compiled to target Tekkit which uses an older Bukkit version. I figured it would work just fine and I was just about right except something little was different. So I have recompiled it and uploaded two different versions. Just use the one 1.0.4RC with out Tekkit on the end.
But, have to wait until the files get approved. They are very slow approving stuff.
This thing crashed the hell out of my server every single time I toggled it on. Needs further testing.