PlayerRole interface represents a role that players can have within an island. Roles form a hierarchical ladder system that determines permissions and privileges within the island.
Understanding Player Roles
Player roles are organized in a weighted ladder system where:- Higher weight = higher position in the hierarchy
- Weight 0 is typically the lowest member role
- Negative weights are reserved for special roles (guest, coop)
- The highest weight role is usually the island leader
Getting Player Roles
Role Properties
Get the unique ID of the role.Each role has a unique ID used for internal storage and identification.
Get the internal name of the role.This is the name used in configuration files and commands.
Get the display name of the role shown in chat, placeholders, and UI.This is the user-facing name that appears in messages and menus.
Get the weight of the role in the ladder hierarchy.The weight determines the role’s position in the hierarchy:
- Higher weight = higher rank
- Weight 0 is typically the base member role
- Negative weights are for special non-ladder roles
Role Comparison
Check whether this role is higher than another role in the hierarchy.
The role to compare against
Check whether this role is less than another role in the hierarchy.
The role to compare against
Role Position Checks
Check whether this role is the first (lowest) role in the ladder.Returns
true for roles with weight 0.Check whether this role is the last (highest) role in the ladder.Returns
true for the role with the highest weight in the system.Check whether the role is part of the role ladder system.Returns
true if:- The role has a weight >= 0, AND
- The role has either a next or previous role
false.Role Navigation
Get the next higher role in the ladder. Returns This is useful for implementing promotion systems.
null if:- This is the last role in the ladder
- The role is not in the ladder (negative weight)
Get the previous lower role in the ladder. Returns This is useful for implementing demotion systems.
null if:- This is the first role in the ladder
- The role is not in the ladder (negative weight)
Common Role Patterns
Checking Authority
Promoting a Player
Demoting a Player
Checking for Leader
Filtering by Role Level
Special Roles
Guest Role
The guest role is assigned to visitors who enter an island without being a member or coop.Coop Role
The coop role is assigned to players who have been added as cooperators to an island.Role Configuration
Roles are typically configured in theroles.yml file:
Role Permissions
Each role has associated default permissions that determine what island privileges members with that role have. These permissions are inherited from lower roles and can be customized per island.Static Utility Methods
The implementation provides several utility methods for working with roles:Best Practices
1. Always Check for Null
2. Use Role Comparison for Authority
3. Check Ladder Status for Promotions
4. Handle Special Roles Appropriately
5. Use Display Names for User-Facing Text
Related Classes
- SuperiorPlayer - See SuperiorPlayer Interface
- IslandPrivilege - Permissions associated with roles
- RolePrivilegeNode - Internal role permission implementation at
/home/daytona/workspace/source/src/main/java/com/bgsoftware/superiorskyblock/island/role/SPlayerRole.java:8
Source Reference
The PlayerRole interface is located at:- API Interface:
/home/daytona/workspace/source/API/src/main/java/com/bgsoftware/superiorskyblock/api/island/PlayerRole.java:1 - Implementation:
/home/daytona/workspace/source/src/main/java/com/bgsoftware/superiorskyblock/island/role/SPlayerRole.java:1