> For the complete documentation index, see [llms.txt](https://tne.gitbook.io/tne-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tne.gitbook.io/tne-docs/developers/creating-custom-account-statuses.md).

# Creating Custom Account Statuses

## Creating Custom Account Statuses for TheNewEconomy

Account statuses in TheNewEconomy allow you to define the rules for how accounts can interact with funds. Custom account statuses can restrict or enable actions such as receiving funds, using balances, or being unlocked with a PIN.

***

### Overview of AccountStatus

The `AccountStatus` interface defines the behavior of account statuses. Each status must implement the following methods:

1. **`identifier()`**: Returns a unique identifier for the status.
2. **`unlockable()`**: Indicates if the status can be unlocked using the account's PIN.
3. **`use()`**: Specifies if the account can use funds.
4. **`receive()`**: Specifies if the account can receive funds.

***

### Example: Implementing a Custom Status

Below is an example of a custom `FrozenStatus`, which blocks all actions:

```java
import net.tnemc.core.account.AccountStatus;
import net.tnemc.plugincore.core.io.maps.MapKey;
import org.jetbrains.annotations.NotNull;

public class FrozenStatus implements AccountStatus {

  @Override
  @MapKey
  public @NotNull String identifier() {
    return "frozen";
  }

  @Override
  public boolean unlockable() {
    return false;
  }

  @Override
  public boolean use() {
    return false;
  }

  @Override
  public boolean receive() {
    return false;
  }
}
```

***

### Example: Default Account Statuses in TNE

#### Normal Status

* **Identifier**: `normal`
* **Unlockable**: No
* **Can Use Funds**: Yes
* **Can Receive Funds**: Yes

```java
public class AccountNormalStatus implements AccountStatus {
  @Override
  public @NotNull String identifier() { return "normal"; }
  @Override
  public boolean unlockable() { return false; }
  @Override
  public boolean use() { return true; }
  @Override
  public boolean receive() { return true; }
}
```

#### Locked Status

* **Identifier**: `locked`
* **Unlockable**: Yes
* **Can Use Funds**: No
* **Can Receive Funds**: Yes

```java
public class AccountLockedStatus implements AccountStatus {
  @Override
  public @NotNull String identifier() { return "locked"; }
  @Override
  public boolean unlockable() { return true; }
  @Override
  public boolean use() { return false; }
  @Override
  public boolean receive() { return true; }
}
```

#### Restricted Status

* **Identifier**: `restricted`
* **Unlockable**: No
* **Can Use Funds**: No
* **Can Receive Funds**: No

```java
public class AccountRestrictedStatus implements AccountStatus {
  @Override
  public @NotNull String identifier() { return "restricted"; }
  @Override
  public boolean unlockable() { return false; }
  @Override
  public boolean use() { return false; }
  @Override
  public boolean receive() { return false; }
}
```

***

### Registering a Custom Status

To register your custom account status, use the following method:

```java
TNECore.eco().account().addAccountStatus(new FrozenStatus());
```

***

### Summary

By implementing the `AccountStatus` interface and registering your custom status with TNE, you can define unique behaviors for accounts, enabling tailored restrictions or permissions for specific gameplay scenarios.

For further details, refer to existing implementations like `AccountNormalStatus`, `AccountLockedStatus`, and `AccountRestrictedStatus` in the TNE source.


---

# 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://tne.gitbook.io/tne-docs/developers/creating-custom-account-statuses.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.
