> For the complete documentation index, see [llms.txt](https://intellectualsites.gitbook.io/plotsquared/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://intellectualsites.gitbook.io/plotsquared/optimization/chunk-processor.md).

# Chunk Processor

## Introduction

{% hint style="danger" %}
This is a new feature, not a magical solution to all your problems. It is however very efficient, and will hardly leave a footprint when there are no chunks to process.
{% endhint %}

The chunk processor will process chunks before they are saved / loaded from disk. It is lightweight at the moment with the **following capabilities**:

* Clear entities if a dangerous amount is detected
* Clear blockstates if a dangerous amount is detected

## Purpose

The **purpose** of the processor is to:

* Decrease server lag
* Prevent potentially dangerous chunks being saved / loaded from disk
* Prevent repeated server crashes from dangerous chunks

The usual **causes of dangerous chunks** are:

* People abusing WorldEdit
* People abusing VoxelSniper
* Any other server-tool you have that can be used to spam entities / blocks

## Configuration

Configuration is done through the `settings.yml`

To enable the chunk processor, set the following:

```yaml
enabled-components:
  # Processes chunks (trimming, or entity/tile limits)
  chunk-processor: true
```

It can then be configured further, changing these values:

```yaml
chunk-processor:
  # Auto trim will not save chunks which aren't claimed
  auto-trim: false
  # Max tile entities per chunk
  max-tiles: 3
  # Max entities per chunk
  max-entities: 512
  # Disable block physics
  disable-physics: false
```

If the tile entity / entity limit has been reached, the chunk processor will remove the entities that exceed the limit when the chunk is saved. It will also prevent players that don't have `/plot toggle worldedit` enabled from exceeding the limit using WorldEdit.

When the chunk processor is activated, players will not be able to use tile entities as a part of the plot components when using `/plot set`.

{% hint style="info" %}
If using Paper, you may also enable `tile-entity-check` under the paper components. This will prevent players from placing new tile entities when the tile entity limit has been reached in that particular chunk.
{% endhint %}

For more information about tile entities see: <https://papermc.io/javadocs/paper/1.18/org/bukkit/block/package-tree.html> + (Or do a google search.)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://intellectualsites.gitbook.io/plotsquared/optimization/chunk-processor.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
