DPC Zettelkasten Open in the explorer

Faction Role

A named bundle of permission overrides that a faction assigns to its members.

A role is a named set of Faction Permission overrides. Each member of a Faction holds exactly one, and a faction defines its own roles rather than picking from a fixed list.

Three-level resolution

The permission map is Map<String, Boolean?>, and the nullability carries meaning. Looking up whether a role grants a permission walks three levels:

  1. The role's own value, if it is not null.
  2. The faction's default for that permission.
  3. The permission's built-in default.

Null therefore means inherit, distinct from an explicit false meaning deny. That distinction is what lets a faction change a default and have every role that has not opted out follow along — a role with all-null values tracks the faction's policy automatically.

Serialized by name

Roles store permissionsByName: Map<String, Boolean?> and resolve those strings to permission objects on read, discarding any that no longer parse. Storing names rather than object references means a permission that is removed from the plugin does not break deserialization of existing factions — the stale entry is simply dropped. It also means a typo silently becomes a no-op, which is the cost of that robustness.

Roles implement Bukkit's ConfigurationSerializable, so they round-trip through the same serialization the rest of the plugin's configuration uses.

Defaults

A new faction is not created with an empty role set. MfFactionRoles.defaults() builds three: Owner, Officer, and Member — with Member as the defaultRoleId that new joiners receive. Owner is granted everything, Officer a curated middle tier (diplomacy, kicking, setting home, and managing the Member role), and Member nothing but the permissions whose own default is true.

A freshly founded faction is therefore immediately governable, and the three-tier shape is a suggestion rather than a constraint — a faction can create, delete, and rename roles from there.

Faction Permission describes what can be granted. Roles are stored inline on the Faction record rather than in their own table, which is why changing a role bumps the faction's Optimistic Locking version.

Sources

Linked from