Inheritance

Inheritance allows groups to automatically receive permissions from other groups. This powerful feature lets you build hierarchies where higher ranks include all permissions from lower ranks.

How Inheritance Works

When a group inherits from another group (called the "parent"), it automatically receives all of the parent's permissions. This is recursive - if the parent also has parents, those permissions are included too.

text
# Example hierarchy:
owner
  ↑ inherits from
admin
  ↑ inherits from
mod
  ↑ inherits from
vip
  ↑ inherits from
default

# A player in "admin" has permissions from:
# - admin (direct)
# - mod (inherited)
# - vip (inherited through mod)
# - default (inherited through vip)

Setting Up Inheritance

CommandDescription
/hp group addparent <group> <parent>Add inheritance
/hp group removeparent <group> <parent>Remove inheritance
text
# Make VIP inherit from default
/hp group addparent vip default

# Make mod inherit from VIP
/hp group addparent mod vip

# Make admin inherit from mod
/hp group addparent admin mod
Think of it as "child gets parent's permissions". The first argument is the child (the group receiving permissions), and the second is the parent (the group giving permissions).

Inheritance Visualization

Here's a visual representation of a typical server hierarchy:

                    ┌─────────┐
                    │  owner  │ weight: 100
                    └────┬────┘
                         │ inherits
                    ┌────┴────┐
                    │  admin  │ weight: 90
                    └────┬────┘
                         │ inherits
                    ┌────┴────┐
                    │   mod   │ weight: 50
                    └────┬────┘
                         │ inherits
              ┌──────────┴──────────┐
              │                     │
         ┌────┴────┐          ┌─────┴────┐
         │   vip   │          │  helper  │
         │ wt: 20  │          │  wt: 30  │
         └────┬────┘          └─────┬────┘
              │                     │
              └──────────┬──────────┘
                         │ both inherit
                    ┌────┴────┐
                    │ default │ weight: 0
                    └─────────┘

Multiple Parents

A group can inherit from multiple parent groups. This is useful for combining different permission sets:

text
# Mod inherits from both vip (donor perks) and helper (staff basics)
/hp group addparent mod vip
/hp group addparent mod helper

# Mod now has permissions from:
# - mod (direct)
# - vip (parent)
# - helper (parent)
# - default (inherited through both)

Inheritance Resolution Order

When multiple sources have the same permission, HyperPerms resolves in this order:

  1. Direct permission on the group - Highest priority
  2. Parent groups by weight - Higher weight parent wins
  3. Recursive parent permissions - Depth-first search
text
# Example conflict resolution:
# - mod has "chat.color: true" directly
# - vip (parent, weight 20) has "chat.color: false"
# - helper (parent, weight 30) has "chat.color: true"

# Result: mod gets "chat.color: true" (direct permission wins)

Overriding Inherited Permissions

You can override inherited permissions by setting them directly on the child group:

text
# VIP has teleport.* (all teleport permissions)
/hp group addpermission vip teleport.* true

# VIP+ inherits from VIP, but we want to deny teleport.player
/hp group addpermission vip+ teleport.player false

# VIP+ has:
# - teleport.* from VIP (inherited)
# - teleport.player: false (direct, overrides inherited)
Direct permissions always override inherited ones. If something isn't working as expected, check for conflicting direct permissions.

Circular Inheritance Prevention

HyperPerms automatically prevents circular inheritance, where groups would inherit from each other in a loop:

text
# This would create a loop:
/hp group addparent admin mod
/hp group addparent mod admin  # ERROR: Would create circular inheritance

# The second command will be rejected
If you try to create circular inheritance, HyperPerms will reject the command with an error message explaining the problem.

Weight and Priority

Group weight affects how inheritance conflicts are resolved and which prefix/suffix is displayed. Higher weight = higher priority.

text
# Player is in both "mod" (weight 50) and "vip" (weight 20)
# When displaying prefix, the "mod" prefix is shown (higher weight)

# When resolving conflicting permissions from parents:
# Higher-weight parent's permission takes precedence

Learn more in the weight guide.

Best Practices

Simple Linear Hierarchy

For most servers, a simple chain works best:

text
default → vip → mod → admin → owner

Each rank inherits from the one below, gaining all its permissions.

Separate Tracks

For complex setups, keep staff and donor tracks separate:

text
Staff track:
default → helper → mod → admin → owner

Donor track:
default → vip → vip+ → mvp

Players can be in groups from both tracks simultaneously.

Avoid Deep Nesting

Deep inheritance chains can be hard to debug. Try to keep inheritance to 3-4 levels maximum.

Document Your Structure

Use the web editor's visual view or create a diagram of your inheritance structure for reference.

Debugging Inheritance

If permissions aren't working as expected:

text
# Check the group's full info including parents
/hp group info <group>

# Enable verbose mode to see permission resolution
/hp verbose

# Check a specific permission check
/hp check <player> <permission>

Example: Complete Server Setup

text
# Create the groups
/hp group create vip
/hp group create helper
/hp group create mod
/hp group create admin
/hp group create owner

# Set weights
/hp group setweight default 0
/hp group setweight vip 20
/hp group setweight helper 30
/hp group setweight mod 50
/hp group setweight admin 90
/hp group setweight owner 100

# Set up inheritance
/hp group addparent vip default
/hp group addparent helper default
/hp group addparent mod vip
/hp group addparent mod helper
/hp group addparent admin mod
/hp group addparent owner admin

# Now:
# - default: basic permissions
# - vip: default + donor perks
# - helper: default + helper tools
# - mod: vip + helper + mod tools (has both parent chains)
# - admin: mod + admin tools
# - owner: admin + owner tools

See Also