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:

  1. Original chunk is generated and cached.
  2. 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.
  3. 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.


Comments

  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members

Recent Files

Bukkit