-
Notifications
You must be signed in to change notification settings - Fork 0
Permissions System
The Constitution Mod utilizes ForgePermissionAPI at its core. CNP is registered as the defaultPermissionHandler within the ForgePermissionAPI. Permission Nodes (including those of other mods) are passed through our PermissionProvider class. We recommend Mod Developers to register their permissions through Forge during Pre-Initialization.
Setting permission nodes for both users and groups has been made very user friendly.
Users.json and Groups.json are existing files under Minecraft/Config/Constitution/JSON
These files are generated after the first launch of the mod, and read/written actively.
One can set permissions by editing these files directly through text editing software,
OR through in game commands (/cnp group perm add or /cnp user perm add )
REMEMBER: Parent Nodes Must Be Specified For Access To Specific Commands (see below):
While nodes can be set in any order, they must be done through an existing hierarchy:
For Example:
Command: /cnp user perm add
(This is what the JSON File for either the group/user "Permissions" array must look like)
"Permissions": [
"constitution",
"constitution.cmd",
"constitution.cmd.perm",
"constitution.cmd.perm.user",
"constitution.cmd.perm.user.perm",
"constitution.cmd.perm.user.perm.add"
]
Minecraft Vanilla Command Permissions look like this:
"Permissions": [
"command.help",
"command.op",
"command.gamemode",
"command.time",
]
CNP was built not to be depended on through conventional means (declaring as a dependency). We have an automated system to register nodes declared in the Groups.json or Users.json files. Meaning, any nodes declared by server owners will be automatically registered during Pre-Init. We respect your project(s) and maintain a no-PR policy (To fix compatibility issues on our own). However, if you wish to do the right thing and comply with Forge follow these instructions:
- Create a collection of your permission nodes.
- Import net.minecraftforge.server.permissions.PermissionsAPI
- Pass your permission nodes through PermissionsAPI.registerNode(String Node) [During PreINIT]
- Do not directly reference the PermissionHandler or declare a new one.
Documentation for every individual node can be found in their respective wiki pages. Click on one of those pages to view the documentation, if it doesn't exist request it in an issue.