> 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/walksylibservermanager/developers/players-api.md).

# Players API

`PlayerControl` is the API equivalent of `/wlcontrol player`

```java
PlayerControl pc = ModControl.get().player(player);
```

## Own restrictions

Restrictions given directly to this player, on top of the global rule set and any rule sets in force for them.

```java
pc.disableFeature("shieldstatus", "other-player-shields", "Tournament rules");
pc.enableFeature("shieldstatus", "other-player-shields");
pc.clearMod("shieldstatus");
```

The methods are the same as on `RuleSet`: `disable`, `disableFeature`, `enable`, `enableFeature`, `clearMod`, with optional reasons. `ownRestrictions()` returns them.

## Rule sets

```java
pc.apply("uhc");
pc.remove("uhc");
pc.appliedRuleSets();
pc.ruleSetsInForce();
pc.clear();
```

`appliedRuleSets()` returns the rule sets applied to the player directly. `ruleSetsInForce()` returns every rule set that currently applies to them, including through their world or permissions. `clear()` drops the player's own restrictions and every applied rule set.

## What's actually off

```java
Set<Restriction> off = pc.effective();

pc.isModDisabled("shieldstatus");
pc.isFeatureDisabled("shieldstatus", "other-player-shields");
pc.isRestricted(Restriction.parse("shieldstatus:other-player-shields"));

pc.isBypassing();
```

`effective()` combines everything: global, rule sets in force, and own restrictions. It's empty for players with `wlcontrol.bypass`.

## The player's client

```java
pc.hasWalksyLib();

pc.client().ifPresent(client -> {
    client.hasMod("shieldstatus");
    client.allows(Restriction.feature("shieldstatus", "other-player-shields"));
    for (ReportedMod mod : client.mods()) {
        mod.modId();
        mod.displayName();
        mod.wholeMod();
        mod.features();
    }
});
```

`client()` is empty until the client has sent its report, which happens shortly after joining. Listen for [`ClientModsReportedEvent`](/walksylib-docs/walksylibservermanager/developers/events.md#clientmodsreportedevent) to know when it arrives.

{% hint style="info" %}
Everything given to a player through `PlayerControl` ends when they disconnect.
{% endhint %}
