Community listing page, reviews may not be monitored by the author.
Permission Validator
No reviews yet
A drop-in solution for integrating permission nodes to your multi-platform mod.
Community voices
Reviews
No reviews yet. Be the first to review this project!
Get it on
Available Platforms
Compatibility
Supported Environments
Runs entirely on the server. Also works in singleplayer.
About
Project Details
For authors
Embed Badge
If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.
Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.
Identifiers
Platform IDs
About
Description
Permission Validator
A drop-in solution for integrating permission nodes to your multi-loader mod.
It works by providing a single, unified API for defining and checking permissions, handling essentially all the heavy lifting for both
Fabric and NeoForge. On Fabric, it also determines if the fabric-permissions-api mod is present, then uses it if so.
You'll most commonly be using this for permission checks in commands, but it can be used for literally any kind of "permission" you want to check for, such as whether a player can use a certain item or access a certain area.
For Users: This is a library mod, you don't need to install it unless a mod requires it. If you're a developer, keep on reading!
Usage Sample
1. Add Dependency
You should just be able to Jar in Jar this into your mod (it's only 16~Kb!).
However, if you really want to you can add it as a dependency in your fabric.mod.json or neoforge.mods.toml file
and require users to install it separately.
repositories {
maven("https://maven.ziroau.com")
}
// For Fabric & Architectury Loom
dependencies {
modApi "com.ziroau:permissionvalidator:${permissionvalidator_version}:fabric-mc${minecraft_version}"
include "com.ziroau:permissionvalidator:${permissionvalidator_version}:fabric-mc${minecraft_version}"
}
// For NeoForge
dependencies {
jarJar(implementation("com.ziroau:permissionvalidator:${permissionvalidator_version}:neoforge-mc${minecraft_version}")) {
version {
strictly "[${permissionvalidator_version},)"
prefer "${permissionvalidator_version}"
}
}
}
// Multiloader 'Common' Project
dependencies {
modCompileOnlyApi "com.ziroau:permissionvalidator:${permissionvalidator_version}:fabric-mc${minecraft_version}"
}
2. Define & Initialize Permissions
object ModPermissions {
val ROOT = PermissionManager.create(
"mod",
PermissionLevel.CHEATS_AND_COMMAND_BLOCKS
)
val RELOAD = PermissionManager.create(
"mod.reload",
PermissionLevel.CHEATS_AND_COMMAND_BLOCKS
)
// Call just before command registration
fun initialize() {
PermissionManager.initialize(listOf(ROOT, RELOAD))
}
}
3. Check Permissions
Within your Brigadier structure, you can use the .requires overload:
import com.ziroau.permissionvalidator.api.PermissionManager.requires
object ModComands {
fun register(dispatcher: CommandDispatcher<ServerCommandSource>) {
ModPermissions.initialize()
val root = Commands.literal("commandroot")
.requires(ModPermissions.ROOT)
.executes { ctx -> modInfo(ctx.source) }
.then(
//** /commandroot reload */
Commands.literal("reload")
.requires(ModPermissions.RELOAD)
.executes { ctx -> reload(ctx.source) }
)
}
}
Or in some other random context:
fun someRandomFunction(player: ServerPlayerEntity) {
if (PermissionManager.hasPermission(player, ModPermissions.RELOAD)) {
// do something
} else {
// did not have permission to do something :(
}
}
Screenshots
Gallery
Versions
Files
Relations
Project Relations
More like this
Similar Mods
Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.
On ModDex
Community snapshot
By the numbers
Statistics
Get it on
Available Platforms
On ModDex
Community snapshot
By the numbers