dev.polymodloader.api.permission
This page is generated from the source's Javadoc by ./gradlew apiReference. Do not edit it; fix the source comment and generate it again.
| Type | Kind | Description |
|---|---|---|
PermissionNode | record | A named permission, <mod id>.<path>. |
PermissionProvider | functional interface | Decides permissions, for example from a permissions file or groups. |
PermissionRegistrar | interface | Declares a mod's permissions and lets permission mods decide them. |
PermissionResult | enum | What a PermissionProvider decided. |
PermissionNode
record · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public record PermissionNode(String id, int defaultLevel)
A named permission, <mod id>.<path>. Permission providers (a permissions mod) decide it per player; without a decision, players need the default operator level.
| Component | Type | Description |
|---|---|---|
id | String | dotted name, for example my_mod.teleport.others |
defaultLevel | int | operator level needed when no provider decides: 0 everyone, 2 game masters, 4 server owners |
PermissionProvider
functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public interface PermissionProvider
Decides permissions, for example from a permissions file or groups. Providers are asked in registration order; the first answer other than PermissionResult.UNDECIDED counts. Called on the server thread, often (command suggestions); keep it fast.
check(PlayerView, PermissionNode)
PermissionResult check(PlayerView player, PermissionNode node)
Since 0.1.0-alpha.4 or earlier
Whether player has node, or PermissionResult.UNDECIDED to let the next provider or the node's default decide.
| Parameter | Type | Description |
|---|---|---|
player | PlayerView | — |
node | PermissionNode | — |
Returns PermissionResult
PermissionRegistrar
interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public interface PermissionRegistrar
Declares a mod's permissions and lets permission mods decide them.
node(String, int)
PermissionNode node(String path, int defaultLevel)
Since 0.1.0-alpha.4 or earlier
Declares <mod id>.<path>.
| Parameter | Type | Description |
|---|---|---|
path | String | dotted, a-z 0-9 _ . |
defaultLevel | int | — |
Returns PermissionNode
Throws IllegalArgumentException — for an invalid or used path (POLY-PERMISSION-001)
provider(PermissionProvider)
void provider(PermissionProvider provider)
Since 0.1.0-alpha.4 or earlier
Adds a provider asked for every permission check of every mod.
| Parameter | Type | Description |
|---|---|---|
provider | PermissionProvider | — |
PermissionResult
enum · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier
public enum PermissionResult
What a PermissionProvider decided.
| Constant | Description |
|---|---|
ALLOW | — |
DENY | — |
UNDECIDED | No opinion; the next provider, or the node's default level, decides. |