> For the complete documentation index, see [llms.txt](https://walksy.gitbook.io/walksylib-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://walksy.gitbook.io/walksylib-docs/advanced/server-opt-out.md).

# Server Opt Out

Servers running **WalksyLibServerManager** can ask clients to disable a mod, or specific features of it.&#x20;

## Opting in the whole mod

```java
private static boolean disabledByServer;

Config.builder()
    .path(PathUtils.ofConfigDir("mymod"))
    .allowOptOutFromServer(disabled -> disabledByServer = disabled)
```

The callback is called with `true` when a server disables your mod and `false` when it's re-enabled, for example when the user leaves the server.

## Opting in individual features

```java
private static final String FEATURE_OTHER_PLAYERS = "other-player-shields";
private static boolean otherPlayersDisabled = false;

Config.builder()
    .allowOptOutFromServer(FEATURE_OTHER_PLAYERS, disabled -> otherPlayersDisabled = disabled)
```

Feature IDs must be 1–64 characters of `a-z`, `0-9`, `_`, `.` or `-`, and each can only be declared once.

You can declare the whole mod and several features in the same config.

## Checking the state

```java
Config config = new MyModConfig().getConfig();

config.isDisabledByServer();
config.isDisabledByServer("other-player-shields");
config.serverDisableReason();
config.serverDisableReason("other-player-shields");
```

{% hint style="info" %}
Only mods and features that you opt in can be disabled. Servers can't turn off anything you haven't declared.
{% endhint %}
